module Parseopt: sig
.. end
Specifies how key names are built from fieldnames
type
keyspec =
type
parsetype =
Specifies how options are tokenized
These functions are provided as handy actions for no-argument keys
val set : 'a -> bool
Set a boolean field to true
val clear : 'a -> bool
Set a boolean field to false
val store : 'a -> 'b -> 'a
Store a value in a field
type 'a
option_parameters = {
|
default : 'a ; |
|
specs : (string * string list * string * string option * 'a action) list ; |
|
to_string : 'a -> string ; |
|
keyspecs : keyspec list ; |
|
usage_prefix : string ; |
|
usage_suffix : string ; |
|
parsetype : parsetype ; |
|
is_option : string -> bool ; |
|
dashdash : bool ; |
|
helpkeys : string list ; |
|
helpfieldwidths : int * int * int ; |
|
keepgoing : bool ; |
}
Specifies how options should be parsed
type 'a
action_parameters = {
}
This type is passed to Action, Conversion, or Handler functions
type 'a
action =
Internal type used by the syntax extension; like Arg.spec
val set' : ('a -> 'a) -> 'a action_parameters -> 'a * string list
If you want an option to be able to affect other elements of the option
structure, you can specify
handler = set' (fun o -> {o with ...})
For example, you could have multiple options that set or clear a flag.
val conversion' : ('a -> string -> 'a) -> 'a action_parameters -> 'a * string list
If you want an option to be able to affect other elements of the option
structure, based on an argument, you can specify
handler = conversion' (fun o s -> {o with ...})
The difference between set' and conversion' is that a conversion'
option takes an argument.
val option_defaults : unit option_parameters
Default values for option parameters
Exceptions that may be raised during the parsing process
exception MissingArgument of string
exception UnknownOption of string
exception ConversionFailure of string * string * string
val help : 'a option_parameters -> unit
Print a help message containing all options
val usage : 'a option_parameters -> unit
Print a usage message
val parse : 'a option_parameters -> string list -> 'a * string list
Parse an arbitrary list of strings as if it were command-line arguments
val parse_argv : 'a option_parameters -> 'a * string list
Parse Sys.argv
$Revision: 1.6 $