Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell98 |
Descriptive.Options
Description
Command-line options parser.
- flag :: Monad m => Text -> Text -> v -> Consumer [Text] (Option a) m v
- switch :: Monad m => Text -> Text -> Consumer [Text] (Option a) m Bool
- prefix :: Monad m => Text -> Text -> Consumer [Text] (Option a) m Text
- arg :: Monad m => Text -> Text -> Consumer [Text] (Option a) m Text
- anyString :: Monad m => Text -> Consumer [Text] (Option a) m Text
- constant :: Monad m => Text -> Text -> v -> Consumer [Text] (Option a) m v
- stop :: Monad m => Consumer [Text] (Option a) m a -> Consumer [Text] (Option a) m ()
- data Option a
- textDescription :: Description (Option a) -> Text
- textOpt :: Option a -> Text
Existence flags
Arguments
:: Monad m | |
=> Text | Name. |
-> Text | Description. |
-> v | Value returned when present. |
-> Consumer [Text] (Option a) m v |
Find a value flag which must succeed. Removes it from the argument list if it succeeds.
Find a boolean flag. Always succeeds. Omission counts as
False
. Removes it from the argument list if it returns True.
Text input arguments
Find an argument prefixed by -X. Removes it from the argument list when it succeeds.
Find a named argument e.g. --name value
. Removes it from the
argument list when it succeeds.
Token consumers
anyString :: Monad m => Text -> Consumer [Text] (Option a) m Text Source
Consume one argument from the argument list and pops it from the start of the list.
Consume one argument from the argument list which must match the given string, and also pops it off the argument list.
Special control
Arguments
:: Monad m | |
=> Consumer [Text] (Option a) m a | A parser which, when it succeeds, causes the whole parser to stop. |
-> Consumer [Text] (Option a) m () |
If the consumer succeeds, stops the whole parser and returns
Stopped
immediately.
Description
Description of a commandline option.
textDescription :: Description (Option a) -> Text Source
Make a text description of the command line options.