package batteries
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=b691e5870f876c6e590d6aa51b4c5457
sha512=3b0643ff337cd70da8c4b77887d212e82d043a7163fca36588be12186bc86bbcf0d56b13349325f12eabb96c846204c88560786342f50af7bf4e20b9480d3964
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.