package batteries
Install
Dune Dependency
Authors
Maintainers
Sources
md5=ea26b5c72e6731e59d856626049cca4d
sha512=55975b62c26f6db77433a3ac31f97af609fc6789bb62ac38b267249c78fd44ff37fe81901f1cf560857b9493a6046dd37b0d1c0234c66bd59e52843aac3ce6cb
doc/batteries.unthreaded/BatOptParse/OptParser/index.html
Module BatOptParse.OptParser
Source
This module contains the option parser itself.
It provides functions to create, populate and use option parsers to parse command line arguments.
Exceptions
Option_conflict name
is raised by OptParse.OptParser.add
when two different options are added with identical names. Usually this doesn't need to be caught since this error is usually easily fixed permanently by removing/renaming the conflicting option names.
Types
The type of an option parser.
The type of an option group.
Option parser creation
val make :
?usage:string ->
?description:string ->
?version:string ->
?suppress_usage:bool ->
?suppress_help:bool ->
?only_leading_opts:bool ->
?prog:string ->
?formatter:Formatter.t ->
unit ->
t
Creates a new option parser with the given options.
val add :
t ->
?group:group ->
?help:string ->
?hide:bool ->
?short_name:char ->
?short_names:char list ->
?long_name:string ->
?long_names:string list ->
'a Opt.t ->
unit
Add an option to the option parser.
Add a group to the option parser.
Output and error handling
Display an error message and exit the program. The error message is printed to the channel chn
(default is Pervasives.stderr
) and the program exits with exit status status
(default is 1).
Display the usage message to the channel chn
(default is Pervasives.stdout
) and return.
Option parsing
Parse arguments as if the arguments args.(first)
, args.(first+1)
, ..., args.(last)
had been given on the command line. By default first
is 0 and last
is the index of the last element of the array.