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

Safe HaskellSafe-Inferred
LanguageHaskell98

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

infoFullDesc :: Bool

whether the help text should contain full documentation

infoProgDesc :: Chunk Doc

brief parser description

infoHeader :: Chunk Doc

header of the full parser description

infoFooter :: Chunk Doc

footer of the full parser description

infoFailureCode :: Int

exit code for a parser failure

infoIntersperse :: Bool

allow regular options and flags to occur after arguments (default: True)

Instances

data ParserPrefs Source

Global preferences for a top-level Parser.

Constructors

ParserPrefs 

Fields

prefMultiSuffix :: String

metavar suffix for multiple options

prefDisambiguate :: Bool

automatically disambiguate abbreviations (default: False)

prefShowHelpOnError :: Bool

always show help text on parse errors (default: False)

prefBacktrack :: Bool

backtrack to parent parser when a subcommand fails (default: True)

prefColumns :: Int

number of columns in the terminal, used to format the help page (default: 80)

data Option a Source

A single option of a parser.

Constructors

Option 

Fields

optMain :: OptReader a

reader for this option

optProps :: OptProperties

properties of this option

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] (CReader a) ParseError

option reader

FlagReader [OptName] !a

flag reader

ArgReader (CReader a)

argument reader

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

command reader

Instances

data OptProperties Source

Specification for an individual parser option.

Constructors

OptProperties 

Fields

propVisibility :: OptVisibility

whether this flag is shown is the brief description

propHelp :: Chunk Doc

help text for this option

propMetaVar :: String

metavariable for this option

propShowDefault :: Maybe String

what to show in the help text as the default

data OptVisibility Source

Visibility of an option in the help text.

Constructors

Internal

does not appear in the help text at all

Hidden

only visible in the full description

Visible

visible both in the full and brief descriptions

newtype ReadM a Source

A newtype over 'ReaderT String Except', used by option readers.

Constructors

ReadM 

readerAsk :: ReadM String Source

Return the value being read.

readerAbort :: ParseError -> ReadM a Source

Abort option reader by exiting with a ParseError.

readerError :: String -> ReadM a Source

Abort option reader by exiting with an error message.

data CReader a Source

Constructors

CReader 

Instances

data Parser a Source

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

Constructors

NilP (Maybe a) 
OptP (Option a) 
forall x . MultP (Parser (x -> a)) (Parser x) 
AltP (Parser a) (Parser a) 
forall x . BindP (Parser x) (x -> Parser a) 

newtype ParserM r Source

Constructors

ParserM 

Fields

runParserM :: forall x. (r -> Parser x) -> Parser x
 

newtype Completer Source

Constructors

Completer 

Fields

runCompleter :: String -> IO [String]
 

Instances

newtype ParserFailure h Source

Constructors

ParserFailure 

Fields

execFailure :: String -> (h, ExitCode, Int)
 

type Args = [String] Source

data ArgPolicy Source

Constructors

SkipOpts 
AllowOpts 

Instances

data OptTree a Source

Constructors

Leaf a 
MultNode [OptTree a] 
AltNode [OptTree a] 

Instances

Show a => Show (OptTree a)