Copyright | (c) Simon Bergot |
---|---|
License | BSD3 |
Maintainer | simon.bergot@gmail.com |
Stability | unstable |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell98 |
Base types shared by several EasyConsole modules.
- type Arg = String
- type Args = [Arg]
- type Flags = Map Arg Args
- type NiceArgs = (Args, Flags)
- type ParseResult a = Either String a
- data ParamDescr = ParamDescr {
- argUsageFmt :: String -> String
- argCategory :: String
- argFormat :: String -> String
- argDescr :: String
- argMetaVar :: String
- argUsage :: ParamDescr -> String
- getArgFormat :: ParamDescr -> String
- data Parser a = Parser (NiceArgs -> (ParseResult a, NiceArgs))
- data ParserSpec a = ParserSpec {
- getParserParams :: [ParamDescr]
- getParserFun :: Parser a
- type SpecialAction a = CmdLnInterface a -> NiceArgs -> ParseResult a
- type SpecialFlag a = (ParserSpec Bool, SpecialAction a)
- data CmdLnInterface a = CmdLnInterface {
- cmdArgParser :: ParserSpec a
- specialFlags :: [SpecialFlag a]
- getAppName :: String
- getAppVersion :: Maybe String
- getAppDescr :: Maybe String
- getAppEpilog :: Maybe String
Documentation
type NiceArgs = (Args, Flags) Source
Structured args to be parsed. Pair of (positionnal arguments, flag arguments)
type ParseResult a = Either String a Source
Type representing the result of the parse. Right val in case of success or Left msg if there was an error.
data ParamDescr Source
Data structure describing a parameter
ParamDescr | |
|
argUsage :: ParamDescr -> String Source
Returns a short description of the input format of a parameter.
getArgFormat :: ParamDescr -> String Source
Returns a long description of the input format of a parameter.
A parser actual function
Parser (NiceArgs -> (ParseResult a, NiceArgs)) |
data ParserSpec a Source
Represent a full parameter spec
ParserSpec | |
|
type SpecialAction a = CmdLnInterface a -> NiceArgs -> ParseResult a Source
A special action with more possibilities. The full arg list will be provided, with the command line spec itself.
type SpecialFlag a = (ParserSpec Bool, SpecialAction a) Source
A special parser allowing to perform standard actions. Used for versionhelpsubparsers.
data CmdLnInterface a Source
A command line application, with a parser and a description
CmdLnInterface | |
|