Safe Haskell | None |
---|---|
Language | Haskell2010 |
Cardano.CLI.Option.Flag
Synopsis
- data Flag a = Flag String String FlagOptions a
- newtype FlagOptions = FlagOptions Defaultness
- data Defaultness
- setDefault :: Flag a -> Flag a
- mkFlag :: forall a (fs :: [Type]). a :| fs => String -> String -> a -> Flag (Vary fs)
- parserFromFlags :: Parser a -> (Flag a -> String) -> [Flag a] -> Parser a
Documentation
A flag that can be used in the command line interface.
It contains information about how to render the flag, its long name,
its content, and its value.
The type variable a
represents the type of the value that the flag holds.
The reason for this type instead of using 'Parser a' directly is to allow for more complex parsing logic, such as handling default values.
Constructors
Flag String String FlagOptions a |
Instances
newtype FlagOptions Source #
Options for a flag that control how it is rendered and parsed.
Constructors
FlagOptions Defaultness |
Instances
Generic FlagOptions Source # | |||||
Defined in Cardano.CLI.Option.Flag.Type Associated Types
Methods from :: FlagOptions -> Rep FlagOptions x Source # to :: Rep FlagOptions x -> FlagOptions Source # | |||||
Show FlagOptions Source # | |||||
Defined in Cardano.CLI.Option.Flag.Type | |||||
Eq FlagOptions Source # | |||||
Defined in Cardano.CLI.Option.Flag.Type Methods (==) :: FlagOptions -> FlagOptions -> Bool Source # (/=) :: FlagOptions -> FlagOptions -> Bool Source # | |||||
type Rep FlagOptions Source # | |||||
Defined in Cardano.CLI.Option.Flag.Type type Rep FlagOptions = D1 ('MetaData "FlagOptions" "Cardano.CLI.Option.Flag.Type" "cardano-cli-10.9.0.0-inplace" 'True) (C1 ('MetaCons "FlagOptions" 'PrefixI 'True) (S1 ('MetaSel ('Just "isDefault") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Defaultness))) |
data Defaultness Source #
Constructors
IsDefault | |
NonDefault |
Instances
Generic Defaultness Source # | |||||
Defined in Cardano.CLI.Option.Flag.Type Associated Types
Methods from :: Defaultness -> Rep Defaultness x Source # to :: Rep Defaultness x -> Defaultness Source # | |||||
Show Defaultness Source # | |||||
Defined in Cardano.CLI.Option.Flag.Type | |||||
Eq Defaultness Source # | |||||
Defined in Cardano.CLI.Option.Flag.Type Methods (==) :: Defaultness -> Defaultness -> Bool Source # (/=) :: Defaultness -> Defaultness -> Bool Source # | |||||
type Rep Defaultness Source # | |||||
setDefault :: Flag a -> Flag a Source #
parserFromFlags :: Parser a -> (Flag a -> String) -> [Flag a] -> Parser a Source #
Create a parser from a help rendering function and list of flags. A default parser is included at the end of parser alternatives for the default flag (there should only be one default, but if more than one is specified, the first such one is used as the default).