Page
Library
Module
Module type
Parameter
Class
Class type
Source
Clim
SourceCommand Line Interface Maker
Converter type from Cmdliner
.
Type flag meaning the argument isn't fully specified.
Type flag meaning the argument is fully specified.
The argument type.
Flags are boolean values which don't need value: only their presence (true
) or not (false
) give their value.
flag ~docs ~doc ~env aka
defines a new flag whose names are given in aka
.
Optional arguments are the usual argument specified by a -x
or --xxx
notation on command line.
val opt :
?docs:string ->
?docv:string ->
?doc:string ->
?env:string ->
?vopt:'a ->
'a conv ->
'a ->
string list ->
('a, spec) arg
opt ~docs ~docv ~doc ~env ~vopt conv default aka
defines a new optional argument whose names are given in aka
.
val opt_all :
?docs:string ->
?docv:string ->
?doc:string ->
?env:string ->
?vopt:'a ->
'a conv ->
'a list ->
string list ->
('a list, spec) arg
opt_all ~docs ~docv ~doc ~env ~vopt conv default aka
same as opt
but gathers several invocations of the options into a list. For example, this is useful for include directory options used in many tools.
Positional arguments have no name and are supposely mandatory and ordered on command line.
For now, positional arguments combinators are somehow illformed and will be modified in near future so use it carefuly.
To finalize an argument, the following constraints can be used.
required a
ensures that argument a
holding a optional value is given on command line.
non_empty a
ensures that argument a
holding a list is not empty.
last a
ensures that only the last given value on command line will be used for a
.
Configurations hold the command line argument to be used.
Configuration type.
register cfg arg
registers the argument arg
info cfg
and returns a getter to the option's value.
Since commands can have multiple related environment variable, we inherit their definitions from Cmdliner
.
Environment variable specification type.
env ~docs ~doc name
creates a ne environment variable specification named name
.
type 'a command = {
cfg : cfg;
The related configuration.
*)cmd : unit -> 'a;
The command entrypoint.
*)man_xrefs : Cmdliner.Manpage.xref list;
Man references.
*)man : Cmdliner.Manpage.block list;
Additional man documentation.
*)envs : env list;
Environment variables.
*)doc : string;
Main documentation.
*)version : string option;
Version (if any).
*)name : string;
Binary name.
*)}
The command type. It gathers all Cmdliner
related informations into one simle data structure.
val command :
?cfg:cfg ->
?man_xrefs:Cmdliner.Manpage.xref list ->
?man:Cmdliner.Manpage.block list ->
?envs:env list ->
?doc:string ->
?version:string option ->
?name:string ->
(unit -> 'b) ->
'b command
Command maker.
term cmd
returns the Cmdliner
terms and info needed to use Cmdliner
. This ensures some compatiblity with Cmdliner
if defining a legacy Cmdliner
command term.
run cmd
parses the command line according to the cmd
specification and returns the result of the underlying function.