DEPRECATED: use Core.Command instead
command-line parsing with hierarchical sub-commands
module Flag : sig ... end
module Autocomplete : sig ... end
create ~autocomplete ~summary ~usage_arg ~init ~flags ~final main
constructs a base command from the following data:
'accum
a mutable accumulator type for gathering arguments'args
a composite argument type for the command, build from 'accum
autocomplete
an optional argument defining a bash autocompletion
function for the base command.summary
a short description of what the command doesreadme
a longer description of what the command doesusage_arg
an abbreviation of the arguments it expectsinit
a function that creates an mutable
accumulator of type 'accum
flags
a list of command line flags together with their
associated accumulator-mutating actionsfinal
a function that constructs the final argument
structure of type 'args
from the accumulated arguments.
The second argument to the function is the list of all
annonymous arguments. This function should raise an
exception with some explanation if it is unable to
construct a complete value of type 'args
.help
an optional function that will be called to generate help
for a command instead of the standard helpmain
the main function, parameterized by the argument structureval create : ?autocomplete:Autocomplete.t ‑> ?readme:(unit ‑> string) ‑> summary:string ‑> usage_arg:string ‑> init:(unit ‑> 'accum) ‑> flags:'accum Flag.t list ‑> final:('accum ‑> string list ‑> 'argv) ‑> ('argv ‑> unit) ‑> t
val create0 : ?autocomplete:Autocomplete.t ‑> ?readme:(unit ‑> string) ‑> summary:string ‑> usage_arg:string ‑> init:(unit ‑> 'accum) ‑> flags:'accum Flag.t list ‑> final:('accum ‑> 'args) ‑> ('args ‑> unit) ‑> t
val create_no_accum : ?autocomplete:Autocomplete.t ‑> ?readme:(unit ‑> string) ‑> summary:string ‑> usage_arg:string ‑> flags:unit Flag.t list ‑> final:(string list ‑> 'args) ‑> ('args ‑> unit) ‑> t
val create_no_accum0 : ?autocomplete:Autocomplete.t ‑> ?readme:(unit ‑> string) ‑> summary:string ‑> usage_arg:string ‑> flags:unit Flag.t list ‑> (unit ‑> unit) ‑> t
group ~summary [...; (name_i, t_i); ...]
is an aggregate command
that dispatches to one of the named sub-commands. A "help"
sub-command will also be generated for the group.
The name cannot contain underscores, however passing allow_underscores=true
into run
will parse underscores as dashes on the command line.
type 'a with_run_flags
= ?version:string ‑> ?build_info:string ‑> ?argv:string list ‑> ?allow_unknown_flags:bool ‑> ?allow_underscores:bool ‑> ?hash_bang_expand:bool ‑> ?post_parse:([ `Ok | `Error | `Help ] ‑> string list ‑> unit) ‑> t ‑> 'a
val run : unit with_run_flags
module Version : sig ... end
module Annotated_field : sig ... end
This module is intended to help in using pa_fields to easily generate Command.t's when you have a record type each field of which you would like specified as a command line argument.
module Flags_ext : sig ... end
module Helpers : sig ... end
val of_core_command : Core.Command.t ‑> t