Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell98 |
Synopsis
- data ParseError
- data ParserInfo a = ParserInfo {
- infoParser :: Parser a
- infoFullDesc :: Bool
- infoProgDesc :: Chunk Doc
- infoHeader :: Chunk Doc
- infoFooter :: Chunk Doc
- infoFailureCode :: Int
- infoPolicy :: ArgPolicy
- data ParserPrefs = ParserPrefs {}
- data Option a = Option {
- optMain :: OptReader a
- optProps :: OptProperties
- data OptName
- isShortName :: OptName -> Bool
- isLongName :: OptName -> Bool
- data OptReader a
- data OptProperties = OptProperties {
- propVisibility :: OptVisibility
- propHelp :: Chunk Doc
- propMetaVar :: String
- propShowDefault :: Maybe String
- propShowGlobal :: Bool
- propDescMod :: Maybe (Doc -> Doc)
- data OptVisibility
- data Backtracking
- newtype ReadM a = ReadM {
- unReadM :: ReaderT String (Except ParseError) a
- readerAsk :: ReadM String
- readerAbort :: ParseError -> ReadM a
- readerError :: String -> ReadM a
- data CReader a = CReader {
- crCompleter :: Completer
- crReader :: ReadM a
- data Parser a
- newtype ParserM r = ParserM {
- runParserM :: forall x. (r -> Parser x) -> Parser x
- newtype Completer = Completer {
- runCompleter :: String -> IO [String]
- mkCompleter :: (String -> IO [String]) -> Completer
- newtype CompletionResult = CompletionResult {
- execCompletion :: String -> IO String
- newtype ParserFailure h = ParserFailure {
- execFailure :: String -> (h, ExitCode, Int)
- data ParserResult a
- overFailure :: (ParserHelp -> ParserHelp) -> ParserResult a -> ParserResult a
- type Args = [String]
- data ArgPolicy
- newtype ArgumentReachability = ArgumentReachability {}
- data AltNodeType
- data OptTree a
- data ParserHelp = ParserHelp {}
- data SomeParser = forall a. SomeParser (Parser a)
- data Context = forall a. Context String (ParserInfo a)
- data IsCmdStart
- fromM :: ParserM a -> Parser a
- oneM :: Parser a -> ParserM a
- manyM :: Parser a -> ParserM [a]
- someM :: Parser a -> ParserM [a]
- filterOptional :: OptTree a -> OptTree a
- optVisibility :: Option a -> OptVisibility
- optMetaVar :: Option a -> String
- optHelp :: Option a -> Chunk Doc
- optShowDefault :: Option a -> Maybe String
- optDescMod :: Option a -> Maybe (Doc -> Doc)
Documentation
data ParseError Source #
ErrorMsg String | |
InfoMsg String | |
ShowHelpText (Maybe String) | |
UnknownError | |
MissingError IsCmdStart SomeParser | |
ExpectsArgError String | |
UnexpectedError String SomeParser |
Instances
Semigroup ParseError Source # | |
Defined in Options.Applicative.Types (<>) :: ParseError -> ParseError -> ParseError # sconcat :: NonEmpty ParseError -> ParseError # stimes :: Integral b => b -> ParseError -> ParseError # | |
Monoid ParseError Source # | |
Defined in Options.Applicative.Types mempty :: ParseError # mappend :: ParseError -> ParseError -> ParseError # mconcat :: [ParseError] -> ParseError # |
data ParserInfo a Source #
A full description for a runnable Parser
for a program.
ParserInfo | |
|
Instances
Functor ParserInfo Source # | |
Defined in Options.Applicative.Types fmap :: (a -> b) -> ParserInfo a -> ParserInfo b # (<$) :: a -> ParserInfo b -> ParserInfo a # |
data ParserPrefs Source #
Global preferences for a top-level Parser
.
ParserPrefs | |
|
Instances
Eq ParserPrefs Source # | |
Defined in Options.Applicative.Types (==) :: ParserPrefs -> ParserPrefs -> Bool # (/=) :: ParserPrefs -> ParserPrefs -> Bool # | |
Show ParserPrefs Source # | |
Defined in Options.Applicative.Types showsPrec :: Int -> ParserPrefs -> ShowS # show :: ParserPrefs -> String # showList :: [ParserPrefs] -> ShowS # |
A single option of a parser.
Option | |
|
isShortName :: OptName -> Bool Source #
isLongName :: OptName -> Bool Source #
An OptReader
defines whether an option matches an command line argument.
data OptProperties Source #
Specification for an individual parser option.
OptProperties | |
|
Instances
Show OptProperties Source # | |
Defined in Options.Applicative.Types showsPrec :: Int -> OptProperties -> ShowS # show :: OptProperties -> String # showList :: [OptProperties] -> ShowS # |
data OptVisibility Source #
Visibility of an option in the help text.
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 |
Instances
Eq OptVisibility Source # | |
Defined in Options.Applicative.Types (==) :: OptVisibility -> OptVisibility -> Bool # (/=) :: OptVisibility -> OptVisibility -> Bool # | |
Ord OptVisibility Source # | |
Defined in Options.Applicative.Types compare :: OptVisibility -> OptVisibility -> Ordering # (<) :: OptVisibility -> OptVisibility -> Bool # (<=) :: OptVisibility -> OptVisibility -> Bool # (>) :: OptVisibility -> OptVisibility -> Bool # (>=) :: OptVisibility -> OptVisibility -> Bool # max :: OptVisibility -> OptVisibility -> OptVisibility # min :: OptVisibility -> OptVisibility -> OptVisibility # | |
Show OptVisibility Source # | |
Defined in Options.Applicative.Types showsPrec :: Int -> OptVisibility -> ShowS # show :: OptVisibility -> String # showList :: [OptVisibility] -> ShowS # |
data Backtracking Source #
Instances
Eq Backtracking Source # | |
Defined in Options.Applicative.Types (==) :: Backtracking -> Backtracking -> Bool # (/=) :: Backtracking -> Backtracking -> Bool # | |
Show Backtracking Source # | |
Defined in Options.Applicative.Types showsPrec :: Int -> Backtracking -> ShowS # show :: Backtracking -> String # showList :: [Backtracking] -> ShowS # |
A newtype over 'ReaderT String Except', used by option readers.
readerAbort :: ParseError -> ReadM a Source #
Abort option reader by exiting with a ParseError
.
readerError :: String -> ReadM a Source #
Abort option reader by exiting with an error message.
CReader | |
|
A Parser a
is an option parser returning a value of type a
.
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) |
ParserM | |
|
A shell complete function.
Completer | |
|
newtype CompletionResult Source #
Instances
Show CompletionResult Source # | |
Defined in Options.Applicative.Types showsPrec :: Int -> CompletionResult -> ShowS # show :: CompletionResult -> String # showList :: [CompletionResult] -> ShowS # |
newtype ParserFailure h Source #
ParserFailure | |
|
Instances
Functor ParserFailure Source # | |
Defined in Options.Applicative.Types fmap :: (a -> b) -> ParserFailure a -> ParserFailure b # (<$) :: a -> ParserFailure b -> ParserFailure a # | |
Show h => Show (ParserFailure h) Source # | |
Defined in Options.Applicative.Types showsPrec :: Int -> ParserFailure h -> ShowS # show :: ParserFailure h -> String # showList :: [ParserFailure h] -> ShowS # |
data ParserResult a Source #
Result of execParserPure
.
Instances
Monad ParserResult Source # | |
Defined in Options.Applicative.Types (>>=) :: ParserResult a -> (a -> ParserResult b) -> ParserResult b # (>>) :: ParserResult a -> ParserResult b -> ParserResult b # return :: a -> ParserResult a # | |
Functor ParserResult Source # | |
Defined in Options.Applicative.Types fmap :: (a -> b) -> ParserResult a -> ParserResult b # (<$) :: a -> ParserResult b -> ParserResult a # | |
Applicative ParserResult Source # | |
Defined in Options.Applicative.Types pure :: a -> ParserResult a # (<*>) :: ParserResult (a -> b) -> ParserResult a -> ParserResult b # liftA2 :: (a -> b -> c) -> ParserResult a -> ParserResult b -> ParserResult c # (*>) :: ParserResult a -> ParserResult b -> ParserResult b # (<*) :: ParserResult a -> ParserResult b -> ParserResult a # | |
Show a => Show (ParserResult a) Source # | |
Defined in Options.Applicative.Types showsPrec :: Int -> ParserResult a -> ShowS # show :: ParserResult a -> String # showList :: [ParserResult a] -> ShowS # |
overFailure :: (ParserHelp -> ParserHelp) -> ParserResult a -> ParserResult a Source #
Policy for how to handle options within the parse
Intersperse | The default policy, options and arguments can be interspersed. A `--` option can be passed to ensure all following commands are treated as arguments. |
NoIntersperse | Options must all come before arguments, once a
single positional argument or subcommand is parsed,
all remaining arguments are treated as positionals.
A `--` option can be passed if the first positional
one needs starts with |
AllPositionals | No options are parsed at all, all arguments are treated as positionals. Is the policy used after `--` is encountered. |
ForwardOptions | Options and arguments can be interspersed, but if a given option is not found, it is treated as a positional argument. This is sometimes useful if one is passing through most options to another tool, but are supplying just a few of their own options. |
newtype ArgumentReachability Source #
ArgumentReachability | |
|
Instances
Eq ArgumentReachability Source # | |
Defined in Options.Applicative.Types (==) :: ArgumentReachability -> ArgumentReachability -> Bool # (/=) :: ArgumentReachability -> ArgumentReachability -> Bool # | |
Show ArgumentReachability Source # | |
Defined in Options.Applicative.Types showsPrec :: Int -> ArgumentReachability -> ShowS # show :: ArgumentReachability -> String # showList :: [ArgumentReachability] -> ShowS # |
data AltNodeType Source #
This type encapsulates whether an AltNode
of an OptTree
should be displayed
with brackets around it.
Instances
Eq AltNodeType Source # | |
Defined in Options.Applicative.Types (==) :: AltNodeType -> AltNodeType -> Bool # (/=) :: AltNodeType -> AltNodeType -> Bool # | |
Show AltNodeType Source # | |
Defined in Options.Applicative.Types showsPrec :: Int -> AltNodeType -> ShowS # show :: AltNodeType -> String # showList :: [AltNodeType] -> ShowS # |
data ParserHelp Source #
Instances
Show ParserHelp Source # | |
Defined in Options.Applicative.Help.Types showsPrec :: Int -> ParserHelp -> ShowS # show :: ParserHelp -> String # showList :: [ParserHelp] -> ShowS # | |
Semigroup ParserHelp Source # | |
Defined in Options.Applicative.Help.Types (<>) :: ParserHelp -> ParserHelp -> ParserHelp # sconcat :: NonEmpty ParserHelp -> ParserHelp # stimes :: Integral b => b -> ParserHelp -> ParserHelp # | |
Monoid ParserHelp Source # | |
Defined in Options.Applicative.Help.Types mempty :: ParserHelp # mappend :: ParserHelp -> ParserHelp -> ParserHelp # mconcat :: [ParserHelp] -> ParserHelp # |
data SomeParser Source #
forall a. SomeParser (Parser a) |
Subparser context, containing the name
of the subparser and its parser info.
Used by parserFailure to display relevant usage information when parsing inside a subparser fails.
forall a. Context String (ParserInfo a) |
data IsCmdStart Source #
Instances
Show IsCmdStart Source # | |
Defined in Options.Applicative.Types showsPrec :: Int -> IsCmdStart -> ShowS # show :: IsCmdStart -> String # showList :: [IsCmdStart] -> ShowS # |
filterOptional :: OptTree a -> OptTree a Source #
optVisibility :: Option a -> OptVisibility Source #
optMetaVar :: Option a -> String Source #