uu-options-0.2.0.0: Parse command line options using uu-interleave and uu-parsinglib

Safe HaskellNone
LanguageHaskell98

Options.UU.Interleaved

Synopsis

Documentation

required :: Entry a a Source

a required entry specied an entry which has to be provided; in the record containing the default values one may put undefined

option :: Entry a a Source

an option entry specied an entry which may be provided; if absent the default value is taken

options :: Entry [a] a Source

An options entry specifies an element which may occur more than once. The final value contains the list of all the values encountered.

optionsl :: (ShowParserType a, MonadState [a] m) => (m () -> StateT [b1] Identity b) -> ([Char], P (Str Char String Int) a, [Char]) -> (Gram (P (Str Char String Int)) (b2 -> b1), [Char]) Source

An optionl entry specifies an element which may occur more than once. The last one encountered is taken optionsl :: Entry a a

optionsf :: (ShowParserType a, MonadState [a] m) => (m () -> StateT [c] Identity b) -> ([Char], P (Str Char String Int) a, [Char]) -> (Gram (P (Str Char String Int)) ([c] -> c), [Char]) Source

An optionf entry specifies an element which may occur more than once. The first one encountered is taken optionsf :: Entry a a

flag :: EntryVal a a Source

A flag entry sets a field to a specific value when encountered

flags :: EntryVals a a Source

A flags entry introduces a list of possible parameters, each with a value to which the field should be set

field :: (Functor f, MonadState a m) => (m () -> StateT r Identity b) -> (f (a -> a), t) -> (f (r -> r), t) Source

A field entry introduces a collection of options which are used to set fields in a sub-record of the main record

choose :: EntryVals a a Source

A choose entry introduces a list of choices for the specific entry; precisely one should be given

change :: EntryVals a a Source

A change entry is an optional choose entry

pString :: (IsLocationUpdatedBy loc Char, ListLike state Char) => P (Str Char state loc) [Char] Source

pBool :: (IsLocationUpdatedBy loc Char, ListLike state Char) => P (Str Char state loc) Bool Source

run Source

Arguments

:: a

the record containing the default values

-> (Gram (P (Str Char String Int)) (a -> a), String)

the specification of the various options

-> String

The string containing the given options, separated by EOT

-> Either (OptionResult a) [Char]

The result is either an updated record (Succes) with options or a request for Help. In case of erroneous input an error message is returned.

The function run equips the given option specification with an option to ask for --help. It concatenates the files coming from the command line and terminates them with an EOT. Make sure your command line arguments do not contain an EOT. It parses the command line arguments and updates the `default` record passed to it

data OptionResult a Source

Constructors

Succes a 
Help String