Module Command.Arg_type
Argument types.
val create : ?complete:(Core_kernel.Univ_map.t -> part:Core_kernel__.Import.string -> Core_kernel__.Import.string Core_kernel__.Import.list) -> ?key:'a Core_kernel.Univ_map.Multi.Key.t -> (Core_kernel__.Import.string -> 'a) -> 'a t
An argument type includes information about how to parse values of that type from the command line, and (optionally) how to autocomplete partial arguments of that type via bash's programmable tab-completion. In addition to the argument prefix, autocompletion also has access to any previously parsed arguments in the form of a heterogeneous map into which previously parsed arguments may register themselves by providing a
Univ_map.Key
using the~key
argument tocreate
.If the
of_string
function raises an exception, command line parsing will be aborted and the exception propagated up to top-level and printed along with command-line help.
val map : ?key:'b Core_kernel.Univ_map.Multi.Key.t -> 'a t -> f:('a -> 'b) -> 'b t
Transforms the result of a
t
usingf
.
val of_map : ?key:'a Core_kernel.Univ_map.Multi.Key.t -> 'a Core_kernel.String.Map.t -> 'a t
An auto-completing
Arg_type
over a finite set of values.
val of_alist_exn : ?key:'a Core_kernel.Univ_map.Multi.Key.t -> (Core_kernel__.Import.string * 'a) Core_kernel__.Import.list -> 'a t
Convenience wrapper for
of_map
. Raises on duplicate keys.
val comma_separated : ?allow_empty:Core_kernel__.Import.bool -> ?key:'a Core_kernel__.Import.list Core_kernel.Univ_map.Multi.Key.t -> ?strip_whitespace:Core_kernel__.Import.bool -> ?unique_values:Core_kernel__.Import.bool -> 'a t -> 'a Core_kernel__.Import.list t
comma_separated t
accepts comma-separated lists of arguments parsed byt
.If
strip_whitespace = true
, whitespace is stripped from each comma-separated string before it is parsed byt
.If
allow_empty = true
then the empty string (or just whitespace, ifstrip_whitespace = true
) results in an empty list, and ifallow_empty = false
then the empty string will fail to parse.If
unique_values = true
no autocompletion will be offered for arguments already supplied in the fragment to complete.
module Export : sig ... end
Values to include in other namespaces.