cli-0.1.0: Command Line Interface

Safe HaskellNone
LanguageHaskell2010

Console.Options

Contents

Synopsis

Running

defaultMain :: OptionDesc (IO ()) () -> IO () Source

parseOptions :: OptionDesc r () -> [String] -> (ProgramDesc r, OptionRes r) Source

Description

programName :: String -> OptionDesc r () Source

Set the program name

programVersion :: Version -> OptionDesc r () Source

Set the program version

programDescription :: String -> OptionDesc r () Source

Set the program description

command :: String -> OptionDesc r () -> OptionDesc r () Source

Create a new sub command

flag :: FlagFrag -> OptionDesc r (Flag Bool) Source

Flag option either of the form -short or --long

for flag that expect a value (optional or mandatory), uses flagArg

flagParam :: FlagFrag -> FlagParser a -> OptionDesc r (FlagParam a) Source

Flag option either of the form -short or --long

for flag that doesn't have parameter, use flag

conflict :: Flag a -> Flag b -> OptionDesc r () Source

give the ability to set options that are conflicting with each other if option a is given with option b then an conflicting error happens

argument :: String -> ValueParser a -> OptionDesc r (Arg a) Source

An unnamed argument

For now, argument in a point of tree that contains sub trees will be ignored. TODO: record a warning or add a strict mode (for developping the CLI) and error.

action :: Action r -> OptionDesc r () Source

Set the action to run in this command

description :: String -> OptionDesc r () Source

Set the description for a command

type Action r = (forall a p. Param p => p a -> Ret p a) -> r Source

Represent a program to run

Arguments

data FlagParser a Source

Constructors

FlagRequired (ValueParser a) 
FlagOptional a (ValueParser a) 

data Flag a Source

data Arg a Source

data Params Source

Constructors

Params 

getParams :: Param p => Params -> forall a. p a -> Ret p a Source