Options.Applicative.Extra
- Package
- purescript-optparse
- Repository
- f-o-a-m/purescript-optparse
This module contains high-level functions to run parsers.
#hsubparser Source
hsubparser :: forall a. Mod CommandFields a -> Parser aBuilder for a command parser with a "helper" option attached.
Used in the same way as subparser, but includes a --help|-h inside
the subcommand.
#execParser Source
execParser :: forall a. ParserInfo a -> Effect aRun a program description.
Parse command line arguments. Display help text and exit if any parse error occurs.
#customExecParser Source
customExecParser :: forall a. ParserPrefs -> ParserInfo a -> Effect aRun a program description with custom preferences.
#execParserPure Source
execParserPure :: forall a. ParserPrefs -> ParserInfo a -> Array String -> ParserResult aThe most general way to run a program description in pure code.
#getParseResult Source
getParseResult :: forall a. ParserResult a -> Maybe aExtract the actual result from a ParserResult value.
This function returns 'Nothing' in case of errors. Possible error messages or completion actions are simply discarded.
If you want to display error messages and invoke completion actions appropriately, use 'handleParseResult' instead.
#handleParseResult Source
handleParseResult :: forall a. ParserResult a -> Effect aHandle ParserResult.
#parserFailure Source
parserFailure :: forall a. ParserPrefs -> ParserInfo a -> ParseError -> Array Context -> ParserFailure ParserHelpGenerate a ParserFailure from a ParseError in a given Context.
This function can be used, for example, to show the help text for a parser:
handleParseResult <<< Failure $ parserFailure pprefs pinfo ShowHelpText mempty
- Modules
- Options.
Applicative - Options.
Applicative. BashCompletion - Options.
Applicative. Builder - Options.
Applicative. Builder. Completer - Options.
Applicative. Builder. Internal - Options.
Applicative. Common - Options.
Applicative. Extra - Options.
Applicative. Help - Options.
Applicative. Help. Chunk - Options.
Applicative. Help. Core - Options.
Applicative. Help. Levenshtein - Options.
Applicative. Help. Pretty - Options.
Applicative. Help. Types - Options.
Applicative. Internal - Options.
Applicative. Internal. Utils - Options.
Applicative. Types - Text.
PrettyPrint. Leijen