argparser-0.3.2: Command line parsing framework for console applications

Portabilityportable
Stabilityunstable
Maintainersimon.bergot@gmail.com
Safe HaskellSafe-Inferred

System.Console.ArgParser.BaseType

Description

Base types shared by several EasyConsole modules.

Synopsis

Documentation

type Arg = StringSource

Simple command line arg

type Args = [Arg]Source

List of args provided

type Flags = Map Arg ArgsSource

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 aSource

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 -> StringSource

Returns a short description of the input format of a parameter.

getArgFormat :: ParamDescr -> StringSource

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 aSource

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