Interpret the command line and a config file as commands and options
|Latest on Hackage:||0.4.2.2|
This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.
This library provides a framework to build command line programs.
The constructed program can have several "commands" that provide different modes of operation. Options can be declared to allow fine-tuning of the behaviour of the program. These options are read from the command line when running the program and from a simple configuration file.
Additionally, there is an interactive mode that reads and executes commands from standard input.
Examples of using this library may be found in the Examples directory in the package tarball.
It provides functionality similar to the cmdargs package. Main differences:
console-program does not use unsafePerformIO, and tries to give a more haskellish, referentially transparent interface;
it allows a full tree of commands, instead of a list, so a command can have subcommands;
it parses a configuration file, in addition to the command line arguments.
Update dependency on directory package.
Update Examples/Full.hs to work with new API
withNonOptionsfunction to consume any number of non-option arguments.
- Add the possibility to customize the prompt in interactive mode.
- Eliminate dependency on unix package on Win32.
- API change: the
Commandconstructor now takes an extra argument (specifying whether the command can be abbreviated on the command line). The function
commandcan be used instead of the old constructor.
- Better handling of exceptions in interactive mode.
- Generalise actions to allow any instance of MonadIO.