| Safe Haskell | Safe-Inferred |
|---|
Options.Applicative.Extra
Contents
- helper :: Parser (a -> a)
- hsubparser :: Mod CommandFields a -> Parser a
- execParser :: ParserInfo a -> IO a
- execParserMaybe :: ParserInfo a -> [String] -> Maybe a
- customExecParser :: ParserPrefs -> ParserInfo a -> IO a
- customExecParserMaybe :: ParserPrefs -> ParserInfo a -> [String] -> Maybe a
- execParserPure :: ParserPrefs -> ParserInfo a -> [String] -> ParserResult a
- newtype ParserFailure = ParserFailure {
- execFailure :: String -> (String, ExitCode)
- data ParserResult a
- data ParserPrefs = ParserPrefs {}
- newtype CompletionResult = CompletionResult {
- execCompletion :: String -> IO String
Extra parser utilities
This module contains high-level functions to run parsers.
hsubparser :: Mod CommandFields a -> Parser aSource
execParser :: ParserInfo a -> IO aSource
Run a program description.
Parse command line arguments. Display help text and exit if any parse error occurs.
execParserMaybe :: ParserInfo a -> [String] -> Maybe aSource
Run a program description in pure code.
This function behaves like execParser, but can be called from pure code.
Note that, in case of errors, no message is displayed, and this function
simply returns Nothing.
If you need to keep track of error messages, use execParserPure instead.
customExecParser :: ParserPrefs -> ParserInfo a -> IO aSource
Run a program description with custom preferences.
customExecParserMaybe :: ParserPrefs -> ParserInfo a -> [String] -> Maybe aSource
Run a program description with custom preferences in pure code.
See execParserMaybe for details.
Arguments
| :: ParserPrefs | Global preferences for this parser |
| -> ParserInfo a | Description of the program to run |
| -> [String] | Program arguments |
| -> ParserResult a |
The most general way to run a program description in pure code.
newtype ParserFailure Source
Constructors
| ParserFailure | |
Fields
| |
data ParserResult a Source
Result of execParserPure.
Constructors
| Success a | |
| Failure ParserFailure | |
| CompletionInvoked CompletionResult |
data ParserPrefs Source
Global preferences for a top-level Parser.
Constructors
| ParserPrefs | |
Fields
| |
newtype CompletionResult Source
Constructors
| CompletionResult | |
Fields
| |