Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module defines a generator for getopt_long
based command
line argument parsing. Each option is associated with arbitrary C
code that will perform side effects, usually by setting some global
variables.
Synopsis
- data Option = Option {}
- data OptionArgument
- generateOptionParser :: String -> [Option] -> Func
Documentation
Specification if a single command line option. The option must have a long name, and may also have a short name.
In the action, the option argument (if any) is stored as in the
char*
-typed variable optarg
.
data OptionArgument Source #
Whether an option accepts an argument.
NoArgument | |
RequiredArgument String | The |
OptionalArgument |
generateOptionParser :: String -> [Option] -> Func Source #
Generate an option parser as a function of the given name, that
accepts the given command line options. The result is a function
that should be called with argc
and argv
. The function returns
the number of argv
elements that have been processed.
If option parsing fails for any reason, the entire process will terminate with error code 1.