cmdtheline-0.1.0.0: Declaritive command-line option parsing and documentation library.

Safe HaskellSafe-Infered

System.Console.CmdTheLine.Term

Contents

Synopsis

Evaluating Terms

Simple command line programs

eval :: [String] -> (Term a, TermInfo) -> IO aSource

eval args ( term, termInfo ) allows the user to pass args directly to the evaluation mechanism. This is useful if some kind of pre-processing is required. If you do not need to pre-process command line arguments, use one of exec or run. On failure the program exits.

exec :: (Term a, TermInfo) -> IO aSource

exec ( term, termInfo ) executes a command line program, directly grabbing the command line arguments from the environment and returning the result upon successful evaluation of term. On failure the program exits.

run :: (Term (IO a), TermInfo) -> IO aSource

run ( term, termInfo ) runs a term containing an IO action, performs the action, and returns the result on success. On failure the program exits.

Multi-command command line programs

evalChoice :: [String] -> (Term a, TermInfo) -> [(Term a, TermInfo)] -> IO aSource

evalChoice args mainTerm choices is analogous to eval, but for programs that provide a choice of commands.

execChoice :: (Term a, TermInfo) -> [(Term a, TermInfo)] -> IO aSource

Analogous to exec, but for programs that provide a choice of commands.

runChoice :: (Term (IO a), TermInfo) -> [(Term (IO a), TermInfo)] -> IO aSource

Analogous to run, but for programs that provide a choice of commands.