argparser-0.3.3: Command line parsing framework for console applications

Copyright(c) Simon Bergot
LicenseBSD3
Maintainersimon.bergot@gmail.com
Stabilityunstable
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell98

System.Console.ArgParser.BaseType

Description

Base types shared by several EasyConsole modules.

Synopsis

Documentation

type Arg = String Source

Simple command line arg

type Args = [Arg] Source

List of args provided

type Flags = Map Arg Args Source

Flag collection with corresponding args

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

Constructors

ParamDescr 

Fields

argUsageFmt :: String -> String

Short description of the parameter format

argCategory :: String

Category of parameter (optional/mandatory)

argFormat :: String -> String

Format of the parameter to provide

argDescr :: String

Description of the parameter

argMetaVar :: String

Description of the parameter in the usage

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.

data Parser a Source

A parser actual function

Constructors

Parser (NiceArgs -> (ParseResult a, NiceArgs)) 

data ParserSpec a Source

Represent a full parameter spec

Constructors

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

Constructors

CmdLnInterface 

Fields

cmdArgParser :: ParserSpec a

The argument parser

specialFlags :: [SpecialFlag a]

The special flags

getAppName :: String

The application name. Usally the binary name.

getAppVersion :: Maybe String

Optional application version

getAppDescr :: Maybe String

Optional description

getAppEpilog :: Maybe String

Optional epilog