descriptive-0.2.0: Self-describing consumers/parsers; forms, cmd-line args, JSON, etc.

Safe HaskellSafe-Inferred
LanguageHaskell98

Descriptive.Options

Contents

Description

Command-line options parser.

Synopsis

Combinators

anyString :: Text -> Consumer [Text] (Option a) Text Source

Consume one argument from the argument list and pops it from the start of the list.

constant Source

Arguments

:: Text

String.

-> Text

Description.

-> Consumer [Text] (Option a) Text 

Consume one argument from the argument list which must match the given string.

flag Source

Arguments

:: Text

Name.

-> Text

Description.

-> v

Value returned when present.

-> Consumer [Text] (Option a) v 

Find a value flag which must succeed.

switch Source

Arguments

:: Text

Name.

-> Text

Description.

-> Consumer [Text] (Option a) Bool 

Find a boolean flag. Always succeeds. Omission counts as False.

prefix Source

Arguments

:: Text

Prefix string.

-> Text

Description.

-> Consumer [Text] (Option a) Text 

Find an argument prefixed by -X.

arg Source

Arguments

:: Text

Name.

-> Text

Description.

-> Consumer [Text] (Option a) Text 

Find a named argument e.g. --name value.

stop Source

Arguments

:: Consumer [Text] (Option a) a

A parser which, when it succeeds, causes the whole parser to stop.

-> Consumer [Text] (Option a) () 

If the consumer succeeds, stops the whole parser and returns immediately.

Description

data Option a Source

Description of a commandline option.

Instances

Eq a => Eq (Option a) 
Show a => Show (Option a) 

textDescription :: Description (Option a) -> Text Source

Make a text description of the command line options.

textOpt :: Option a -> Text Source

Make a text description of an option.