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

Safe HaskellSafe
LanguageHaskell98

Options.Applicative.Types

Synopsis

Documentation

data ParserInfo a

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

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

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

Constructors

OptShort !Char 
OptLong !String 

data OptReader a

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

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

Instances

data OptVisibility

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

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

Constructors

ReadM 

readerAsk :: ReadM String

Return the value being read.

readerAbort :: ParseError -> ReadM a

Abort option reader by exiting with a ParseError.

readerError :: String -> ReadM a

Abort option reader by exiting with an error message.

data CReader a

Constructors

CReader 

Instances

data Parser a

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

Constructors

ParserM 

Fields

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

newtype Completer

Constructors

Completer 

Fields

runCompleter :: String -> IO [String]
 

Instances

newtype ParserFailure h

Constructors

ParserFailure 

Fields

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

type Args = [String]

data ArgPolicy

Constructors

SkipOpts 
AllowOpts 

data OptTree a

Constructors

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

Instances

Show a => Show (OptTree a) 

fromM :: ParserM a -> Parser a

oneM :: Parser a -> ParserM a

manyM :: Parser a -> ParserM [a]

someM :: Parser a -> ParserM [a]