never executed always true always false
1 {-# LANGUAGE FlexibleContexts #-}
2
3 {-# OPTIONS_HADDOCK hide #-}
4
5 module Options.Applicative.Public
6 (
7 -- * Types
8 PublicType (..)
9
10 -- * Applicative Parser
11 , publicOpt
12 ) where
13
14 import Prelude
15
16 import Control.Applicative
17 ( (<|>) )
18 import Options.Applicative
19 ( Parser, flag', long )
20
21
22 data PublicType = WithChainCode | WithoutChainCode
23 deriving (Eq, Show)
24
25 --
26 -- Applicative Parser
27 --
28
29 -- | Parse an 'PublicType' from the command-line, as set of non-overlapping flags.
30 publicOpt :: Parser PublicType
31 publicOpt = withoutCC <|> withCC
32 where
33 withoutCC = flag' WithoutChainCode (long "without-chain-code")
34 withCC = flag' WithChainCode (long "with-chain-code")