package ez_cmdliner
Library
Module
Module type
Parameter
Class
Class type
module TYPES : sig ... end
type spec = TYPES.Arg.spec =
| Unit of unit -> unit
| Bool of bool -> unit
| Set_bool of bool ref
| Set of bool ref
| Clear of bool ref
| String of string -> unit
| Set_string of string ref
| Int of int -> unit
| Set_int of int ref
| Float of float -> unit
| Set_float of float ref
| Symbol of string list * string -> unit
| File of string -> unit
| Anon of int * string -> unit
| Anons of string list -> unit
module MANPAGE = Cmdliner.Manpage
val parse :
?name:string ->
?version:string ->
?man:TYPES.block list ->
(string * TYPES.Arg.spec * string) list ->
(string -> unit) ->
string ->
unit
val translate :
?docs:string ->
(string * TYPES.Arg.spec * string) list ->
(string list * TYPES.Arg.spec * TYPES.info) list
val translate_anon :
(string -> unit) ->
(string list * TYPES.Arg.spec * TYPES.info) list
val env : ?docs:string -> ?doc:string -> string -> TYPES.env
env ~docs ~doc var
describes an environment variable var
. doc
is the man page information of the environment variable, defaults to "undocumented"
. docs
is the title of the man page section in which the environment variable will be listed, it defaults to Manpage.s_environment
.
In doc
the documentation markup language can be used with following variables:
$(env)
, the value ofvar
.- The variables mentioned in
info
val info :
?docs:string ->
?docv:string ->
?env:TYPES.env ->
?version:string ->
string ->
TYPES.info
info docs docv env doc
defines information for an argument.
env
defines the name of an environment variable which is looked up for defining the argument if it is absent from the command line. See environment variables for details.doc
is the man page information of the argument. The documentation language can be used and the following variables are recognized:"$(docv)"
the value ofdocv
(see below)."$(opt)"
, one of the options ofnames
, preference is given to a long one."$(env)"
, the environment var specified byenv
(if any).
These functions can help with formatting argument values.
docv
is for positional and non-flag optional arguments. It is a variable name used in the man page to stand for their value.docs
is the title of the man page section in which the argument will be listed. For optional arguments this defaults toManpage.s_options
. For positional arguments this defaults toManpage.s_arguments
. However a positional argument is only listed if it has both adoc
anddocv
specified.
val sub :
string ->
doc:string ->
?args:TYPES.arg_list ->
?man:TYPES.block list ->
?version:string ->
(unit -> unit) ->
TYPES.sub
sub name action
associates the action action
with the subcommand name
. This module supports only one level of sub-commands, unless you are using the MAKE
functor. With the MAKE
functor, subcommand names can contain spaces.
val main_with_subcommands :
name:string ->
?version:string ->
?default:TYPES.sub ->
doc:string ->
?man:TYPES.block list ->
?topics:(string * Cmdliner.Manpage.block list) list ->
?common_args:TYPES.arg_list ->
?argv:string array ->
TYPES.sub list ->
unit
val main : ?version:string -> ?argv:string array -> TYPES.sub -> unit
module RAWTYPES = TYPES
val raw_env : TYPES.env -> RAWTYPES.env
val raw_info : TYPES.info -> RAWTYPES.info
val raw_sub : TYPES.sub -> RAWTYPES.sub
val to_rst : ?name:string -> TYPES.sub list -> TYPES.arg_list -> string