Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell98 |
Options.Applicative.Types
Synopsis
- data ParseError
- = ErrorMsg String
- | InfoMsg String
- | ShowHelpText (Maybe String)
- | UnknownError
- | MissingError IsCmdStart SomeParser
- | ExpectsArgError String
- | UnexpectedError String SomeParser
- 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 {
- prefMultiSuffix :: String
- prefDisambiguate :: Bool
- prefShowHelpOnError :: Bool
- prefShowHelpOnEmpty :: Bool
- prefBacktrack :: Backtracking
- prefColumns :: Int
- prefHelpLongEquals :: Bool
- prefHelpShowGlobal :: Bool
- prefTabulateFill :: Int
- data Option a = Option {
- optMain :: OptReader a
- optProps :: OptProperties
- data OptName
- isShortName :: OptName -> Bool
- isLongName :: OptName -> Bool
- data OptReader a
- = OptReader [OptName] (CReader a) (String -> ParseError)
- | FlagReader [OptName] !a
- | ArgReader (CReader a)
- | CmdReader (Maybe String) [(String, ParserInfo 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 {
- argumentIsUnreachable :: Bool
- data AltNodeType
- data OptTree a
- data ParserHelp = ParserHelp {
- helpError :: Chunk Doc
- helpSuggestions :: Chunk Doc
- helpHeader :: Chunk Doc
- helpUsage :: Chunk Doc
- helpDescription :: Chunk Doc
- helpBody :: Chunk Doc
- helpGlobals :: Chunk Doc
- helpFooter :: Chunk Doc
- 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 #
Constructors
ErrorMsg String | |
InfoMsg String | |
ShowHelpText (Maybe String) | |
UnknownError | |
MissingError IsCmdStart SomeParser | |
ExpectsArgError String | |
UnexpectedError String SomeParser |
Instances
Monoid ParseError # | |
Defined in Options.Applicative.Types Methods mempty :: ParseError mappend :: ParseError -> ParseError -> ParseError # mconcat :: [ParseError] -> ParseError | |
Semigroup ParseError # | |
Defined in Options.Applicative.Types Methods (<>) :: ParseError -> ParseError -> ParseError # sconcat :: NonEmpty ParseError -> ParseError stimes :: Integral b => b -> ParseError -> ParseError |
data ParserInfo a #
A full description for a runnable Parser
for a program.
Constructors
ParserInfo | |
Fields
|
Instances
Functor ParserInfo # | |
Defined in Options.Applicative.Types |
data ParserPrefs #
Global preferences for a top-level Parser
.
Constructors
ParserPrefs | |
Fields
|
Instances
Show ParserPrefs # | |
Defined in Options.Applicative.Types Methods showsPrec :: Int -> ParserPrefs -> ShowS show :: ParserPrefs -> String showList :: [ParserPrefs] -> ShowS | |
Eq ParserPrefs # | |
Defined in Options.Applicative.Types |
A single option of a parser.
Constructors
Option | |
Fields
|
Instances
isShortName :: OptName -> Bool #
isLongName :: OptName -> Bool #
An OptReader
defines whether an option matches an command line argument.
Constructors
OptReader [OptName] (CReader a) (String -> ParseError) | option reader |
FlagReader [OptName] !a | flag reader |
ArgReader (CReader a) | argument reader |
CmdReader (Maybe String) [(String, ParserInfo a)] | command reader |
data OptProperties #
Specification for an individual parser option.
Constructors
OptProperties | |
Fields
|
Instances
Show OptProperties # | |
Defined in Options.Applicative.Types Methods showsPrec :: Int -> OptProperties -> ShowS show :: OptProperties -> String showList :: [OptProperties] -> ShowS |
data OptVisibility #
Visibility of an option in the help text.
Constructors
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
Show OptVisibility # | |
Defined in Options.Applicative.Types Methods showsPrec :: Int -> OptVisibility -> ShowS show :: OptVisibility -> String showList :: [OptVisibility] -> ShowS | |
Eq OptVisibility # | |
Defined in Options.Applicative.Types | |
Ord OptVisibility # | |
Defined in Options.Applicative.Types Methods compare :: OptVisibility -> OptVisibility -> Ordering (<) :: OptVisibility -> OptVisibility -> Bool (<=) :: OptVisibility -> OptVisibility -> Bool (>) :: OptVisibility -> OptVisibility -> Bool (>=) :: OptVisibility -> OptVisibility -> Bool max :: OptVisibility -> OptVisibility -> OptVisibility min :: OptVisibility -> OptVisibility -> OptVisibility |
data Backtracking #
Constructors
Backtrack | |
NoBacktrack | |
SubparserInline |
Instances
Show Backtracking # | |
Defined in Options.Applicative.Types Methods showsPrec :: Int -> Backtracking -> ShowS show :: Backtracking -> String showList :: [Backtracking] -> ShowS | |
Eq Backtracking # | |
Defined in Options.Applicative.Types |
A newtype over 'ReaderT String Except', used by option readers.
Constructors
ReadM | |
Fields
|
readerAbort :: ParseError -> ReadM a #
Abort option reader by exiting with a ParseError
.
readerError :: String -> ReadM a #
Abort option reader by exiting with an error message.
Constructors
CReader | |
Fields
|
A Parser a
is an option parser returning a value of type a
.
Constructors
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) |
Constructors
ParserM | |
Fields
|
A shell complete function.
Constructors
Completer | |
Fields
|
mkCompleter :: (String -> IO [String]) -> Completer #
Smart constructor for a Completer
newtype CompletionResult #
Constructors
CompletionResult | |
Fields
|
Instances
Show CompletionResult # | |
Defined in Options.Applicative.Types Methods showsPrec :: Int -> CompletionResult -> ShowS show :: CompletionResult -> String showList :: [CompletionResult] -> ShowS |
newtype ParserFailure h #
Constructors
ParserFailure | |
Fields
|
Instances
Functor ParserFailure # | |
Defined in Options.Applicative.Types Methods fmap :: (a -> b) -> ParserFailure a -> ParserFailure b (<$) :: a -> ParserFailure b -> ParserFailure a | |
Show h => Show (ParserFailure h) # | |
Defined in Options.Applicative.Types Methods showsPrec :: Int -> ParserFailure h -> ShowS show :: ParserFailure h -> String showList :: [ParserFailure h] -> ShowS |
data ParserResult a #
Result of execParserPure
.
Constructors
Success a | |
Failure (ParserFailure ParserHelp) | |
CompletionInvoked CompletionResult |
Instances
Applicative ParserResult # | |
Defined in Options.Applicative.Types Methods 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 | |
Functor ParserResult # | |
Defined in Options.Applicative.Types Methods fmap :: (a -> b) -> ParserResult a -> ParserResult b (<$) :: a -> ParserResult b -> ParserResult a | |
Monad ParserResult # | |
Defined in Options.Applicative.Types Methods (>>=) :: ParserResult a -> (a -> ParserResult b) -> ParserResult b (>>) :: ParserResult a -> ParserResult b -> ParserResult b return :: a -> ParserResult a | |
Show a => Show (ParserResult a) # | |
Defined in Options.Applicative.Types Methods showsPrec :: Int -> ParserResult a -> ShowS show :: ParserResult a -> String showList :: [ParserResult a] -> ShowS |
overFailure :: (ParserHelp -> ParserHelp) -> ParserResult a -> ParserResult a #
Policy for how to handle options within the parse
Constructors
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 #
Constructors
ArgumentReachability | |
Fields
|
Instances
Show ArgumentReachability # | |
Defined in Options.Applicative.Types Methods showsPrec :: Int -> ArgumentReachability -> ShowS show :: ArgumentReachability -> String showList :: [ArgumentReachability] -> ShowS | |
Eq ArgumentReachability # | |
Defined in Options.Applicative.Types Methods (==) :: ArgumentReachability -> ArgumentReachability -> Bool (/=) :: ArgumentReachability -> ArgumentReachability -> Bool |
data AltNodeType #
This type encapsulates whether an AltNode
of an OptTree
should be displayed
with brackets around it.
Constructors
MarkDefault | |
NoDefault |
Instances
Show AltNodeType # | |
Defined in Options.Applicative.Types Methods showsPrec :: Int -> AltNodeType -> ShowS show :: AltNodeType -> String showList :: [AltNodeType] -> ShowS | |
Eq AltNodeType # | |
Defined in Options.Applicative.Types |
data ParserHelp #
Constructors
ParserHelp | |
Fields
|
Instances
Monoid ParserHelp # | |
Defined in Options.Applicative.Help.Types Methods mempty :: ParserHelp mappend :: ParserHelp -> ParserHelp -> ParserHelp # mconcat :: [ParserHelp] -> ParserHelp | |
Semigroup ParserHelp # | |
Defined in Options.Applicative.Help.Types Methods (<>) :: ParserHelp -> ParserHelp -> ParserHelp # sconcat :: NonEmpty ParserHelp -> ParserHelp stimes :: Integral b => b -> ParserHelp -> ParserHelp | |
Show ParserHelp # | |
Defined in Options.Applicative.Help.Types Methods showsPrec :: Int -> ParserHelp -> ShowS show :: ParserHelp -> String showList :: [ParserHelp] -> ShowS |
data SomeParser #
Constructors
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.
Constructors
forall a. Context String (ParserInfo a) |
data IsCmdStart #
Instances
Show IsCmdStart # | |
Defined in Options.Applicative.Types Methods showsPrec :: Int -> IsCmdStart -> ShowS show :: IsCmdStart -> String showList :: [IsCmdStart] -> ShowS |
filterOptional :: OptTree a -> OptTree a #
optVisibility :: Option a -> OptVisibility #
optMetaVar :: Option a -> String #
optShowDefault :: Option a -> Maybe String #
optDescMod :: Option a -> Maybe (Doc -> Doc) #