[Haskell-cafe] Command-line options idea

Robin Green greenrd at greenrd.org
Thu Oct 29 03:45:58 EDT 2009


This is not in any way specific to Haskell, but I know a number of
packages on Hackage have executables with command-line options, so:

The non-Haskell program get_iplayer has an excellent idea for
command-line options parsing. Rather than having to remember two
separate syntaxes, one for command line options and one for a
preferences file, the user can simply type

get_iplayer --prefs-add --OPTION[=VALUE]

which will add the equivalent of --OPTION[=VALUE] to the get_iplayer
preferences file (and do nothing else). So it's like a special
"preferences file manipulation mode" of the program.

There are also the following options, as described by --help:

 --prefs-clear                    Remove *ALL* saved user or preset options
 --prefs-del                      Remove specified saved user or preset options
 --prefs-show                     Show saved user or preset options

(This also means that the user doesn't have to remember the filename
of the preferences file.)

I think this sort of thing would be a good idea for *any* program
that has command-line options that some user might want to hold
constant across several runs.

-- 
Robin


More information about the Haskell-Cafe mailing list