[Haskell] ANN: CmdArgs - easy command line argument processing

Neil Mitchell ndmitchell at gmail.com
Mon Sep 14 10:46:43 EDT 2009


Hi,

I am pleased to announce CmdArgs v0.1. CmdArgs is a library for easy
command line argument processing - taking the arguments passed into
your program from getArgs and converting them into a structured value
for use in your program. Compared to the System.Console.GetOpts
library there are two key advantages:

1) The command line argument processors are shorter - in a typical
case they are about 1/3 the size, 90 lines with getopts vs 30 simpler
lines with CmdArgs (for HLint).

2) CmdArgs can support multiple mode command lines, such as those
found in hpc, darcs and cabal.

The guiding principle of CmdArgs is to try and write each piece of
information only once, which makes the command line processing
shorter, and eliminates many of the accidental copy-and-paste style
bugs that are easy with getopts. CmdArgs requires GHC, but other than
this restriction, I do not foresee any reason for anyone to use
getopts over CmdArgs.

To install use the standard cabal magic:

cabal update && cabal install cmdargs

Useful links

Home page: http://community.haskell.org/~ndm/cmdargs/
Manual: http://community.haskell.org/~ndm/darcs/cmdargs/cmdargs.htm
Haddock: http://hackage.haskell.org/packages/archive/cmdargs/latest/doc/html/System-Console-CmdArgs.html

If you want to start using CmdArgs I recommend reading through the
manual, and referring to the haddock documentation as necessary.

I welcome any comments and bug reports.

Thanks, Neil


More information about the Haskell mailing list