optparse-applicative-0.1.1: Utilities and combinators for parsing command line options

Safe HaskellSafe-Infered

Options.Applicative.Types

Synopsis

Documentation

data ParserInfo a Source

A full description for a runnable Parser for a program.

Constructors

ParserInfo 

Fields

_infoParser :: Parser a

the option parser for the program

_infoDesc :: ParserDesc

description of the parser

Instances

data ParserDesc Source

Attributes that can be associated to a Parser.

Constructors

ParserDesc 

Fields

_descFull :: Bool

whether the help text should contain full documentation

_descProg :: String

brief parser description

_descHeader :: String

header of the full parser description

_descFooter :: String

footer of the full parser description

_descFailureCode :: Int

exit code for a parser failure

data Context whereSource

Instances

data Option r a Source

Specification for an individual parser option.

Constructors

Option

option continuation

Fields

_optMain :: OptReader r

reader for this option

_optDefault :: Maybe a

default value

_optShow :: Bool

whether this flag is shown is the brief description

_optHelp :: String

help text for this option

_optMetaVar :: String

metavariable for this option

_optCont :: r -> P (Parser a)
 

Instances

data OptName Source

Constructors

OptShort !Char 
OptLong !String 

Instances

data OptReader a Source

An OptReader defines whether an option matches an command line argument.

Constructors

OptReader [OptName] (String -> Maybe a)

option reader

FlagReader [OptName] !a

flag reader

ArgReader (String -> Maybe a)

argument reader

CmdReader [String] (String -> Maybe (ParserInfo a))

command reader

Instances

data Parser a whereSource

A Parser a is an option parser returning a value of type a.

Constructors

NilP :: a -> Parser a 
ConsP :: Option r (a -> b) -> Parser a -> Parser b 

data ParserFailure Source

Result after a parse error.

Constructors

ParserFailure 

Fields

errMessage :: String -> String

Function which takes the program name as input and returns an error message

errExitCode :: ExitCode

Exit code to use for this error

Instances

optCont :: Lens (Option r a) (r -> P (Parser a))Source