A hidden "helper" option which always fails.
A common usage pattern is to apply this applicatively when creating a ParserInfo
opts :: ParserInfo Sample
opts = info (sample <**> helper) mempty:: a typeCtrl KGHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05
Moduleoptparse-applicative-0.18.1.0Haskell98
This module contains high-level functions to run parsers.
A hidden "helper" option which always fails.
A common usage pattern is to apply this applicatively when creating a ParserInfo
opts :: ParserInfo Sample
opts = info (sample <**> helper) memptyLike helper, but with a minimal set of modifiers that can be extended as desired.
opts :: ParserInfo Sample
opts = info (sample <**> helperWith (mconcat [
long "help",
short 'h',
help "Show this help text",
hidden
])) memptyBuilder for a command parser with a "helper" option attached. Used in the same way as subparser, but includes a "--help|-h" inside the subcommand.
A hidden "--version" option that displays the version.
opts :: ParserInfo Sample
opts = info (sample <**> simpleVersioner "v1.2.3") memptyRun a program description.
Parse command line arguments. Display help text and exit if any parse error occurs.
Run a program description with custom preferences.
execParserPure :: ParserPrefsGlobal preferences for this parser
-> ParserInfo aDescription of the program to run
-> [String]Program arguments
-> ParserResult aThe most general way to run a program description in pure code.
Extract 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.
Handle ParserResult.
Generate 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 Nothing) memptyParserFailureexecFailure :: String -> (h, ExitCode, Int)Functor ParserFailureDefined in optparse-applicative-0.18.1.0 · Options.Applicative.TypesShow h => Show (ParserFailure h)Defined in optparse-applicative-0.18.1.0 · Options.Applicative.TypesResult of execParserPure.
Monad ParserResultDefined in optparse-applicative-0.18.1.0 · Options.Applicative.TypesFunctor ParserResultDefined in optparse-applicative-0.18.1.0 · Options.Applicative.TypesApplicative ParserResultDefined in optparse-applicative-0.18.1.0 · Options.Applicative.TypesShow a => Show (ParserResult a)Defined in optparse-applicative-0.18.1.0 · Options.Applicative.TypesGlobal preferences for a top-level Parser.
ParserPrefsprefMultiSuffix :: Stringmetavar suffix for multiple options
prefDisambiguate :: Boolautomatically disambiguate abbreviations (default: False)
prefShowHelpOnError :: Boolalways show help text on parse errors (default: False)
prefShowHelpOnEmpty :: Boolshow the help text for a command or subcommand if it fails with no input (default: False)
prefBacktrack :: Backtrackingbacktrack to parent parser when a subcommand fails (default: Backtrack)
prefColumns :: Intnumber of columns in the terminal, used to format the help page (default: 80)
prefHelpLongEquals :: Boolwhen displaying long names in usage and help,
use an = sign for long names, rather than a
single space (default: False)
prefHelpShowGlobal :: Boolwhen displaying subparsers' usage help, show parent options under a "global options" section (default: False)
prefTabulateFill :: IntIndentation width for tables
Eq ParserPrefsDefined in optparse-applicative-0.18.1.0 · Options.Applicative.TypesShow ParserPrefsDefined in optparse-applicative-0.18.1.0 · Options.Applicative.TypesShow CompletionResultDefined in optparse-applicative-0.18.1.0 · Options.Applicative.Types