Options.Applicative.Common
- Package
- purescript-optparse
- Repository
- f-o-a-m/purescript-optparse
#showOption Source
showOption :: OptName -> String
#runParserInfo Source
runParserInfo :: forall m a. MonadP m => ParserInfo a -> Args -> m a
#runParserFully Source
runParserFully :: forall m a. MonadP m => ArgPolicy -> Parser a -> Args -> m a
#runParser Source
runParser :: forall m a. MonadP m => ArgPolicy -> IsCmdStart -> Parser a -> Args -> m (Tuple a Args)
Apply a 'Parser' to a command line, and return a result and leftover arguments. This function returns an error if any parsing error occurs, or if any options are missing and don't have a default value.
#evalParser Source
evalParser :: forall a. Parser a -> Maybe a
The default value of a 'Parser'. This function returns an error if any of the options don't have a default value.
#mapParser Source
mapParser :: forall a b. (forall x. OptHelpInfo -> Option x -> b) -> Parser a -> Array b
Map a polymorphic function over all the options of a parser, and collect the results in a list.
#treeMapParser Source
treeMapParser :: forall a b. (forall x. OptHelpInfo -> Option x -> b) -> Parser a -> OptTree b
Like 'mapParser', but collect the results in a tree structure.
Re-exports from Options.Applicative.Types
#ParserPrefs Source
newtype ParserPrefs
Global preferences for a top-level 'Parser'. A 'ParserPrefs' contains general preferences for all command-line options, and can be built with the 'prefs' function.
Constructors
ParserPrefs { prefBacktrack :: Backtracking, prefColumns :: Int, prefDisambiguate :: Boolean, prefMultiSuffix :: String, prefShowHelpOnEmpty :: Boolean, prefShowHelpOnError :: Boolean }
Instances
#ParserInfo Source
newtype ParserInfo a
A 'ParserInfo' describes a command line program, used to generate a help screen. Two help modes are supported: brief and full. In brief mode, only an option and argument summary is displayed, while in full mode each available option and command, including hidden ones, is described.
A basic 'ParserInfo' with default values for fields can be created using the 'info' function.
Constructors
ParserInfo { infoFailureCode :: ExitCode, infoFooter :: Chunk Doc, infoFullDesc :: Boolean, infoHeader :: Chunk Doc, infoParser :: Parser a, infoPolicy :: ArgPolicy, infoProgDesc :: Chunk Doc }
Instances
#Parser Source
data Parser a
A 'Parser' is the core type in optparse-applicative. A value of type Parser a@ represents a specification for a set of options, which will yield a value of type a when the command line arguments are successfully parsed.
There are several types of primitive 'Parser'.
Flags: simple no-argument options. When a flag is encountered on the command line, its value is returned.
Options: options with an argument. An option can define a /reader/, which converts its argument from String to the desired value, or throws a parse error if the argument does not validate correctly.
Arguments: positional arguments, validated in the same way as option arguments.
Commands. A command defines a completely independent sub-parser. When a command is encountered, the whole command line is passed to the corresponding parser.
** Parser builders
Each parser builder takes an option modifier. A modifier can be created by composing the basic modifiers provided by here using the 'Monoid' operations mempty' and 'append', or their aliases 'idm' and '<>'.
For example:
out = strOption ( long "output" <> short 'o' <> metavar "FILENAME" )
creates a parser for an option called "output".
Instances
- 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