Command.AnonsAnonymous command-line argument specification.
A specification of some number of anonymous arguments.
val (%:) : Base.string -> 'a Arg_type.t -> 'a t(name %: typ) specifies a required anonymous argument of type typ.
The name must not be surrounded by whitespace; if it is, an exn will be raised.
If the name is surrounded by a special character pair (<>, {}, [] or (),) name will remain as-is, otherwise, name will be uppercased.
In the situation where name is only prefixed or only suffixed by one of the special character pairs, or different pairs are used (e.g., "<ARG]"), an exn will be raised.
The (possibly transformed) name is mentioned in the generated help for the command.
sequence anons specifies a sequence of anonymous arguments. An exception will be raised if anons matches anything other than a fixed number of anonymous arguments.
non_empty_sequence_as_pair anons and non_empty_sequence_as_list anons are like sequence anons except that an exception will be raised if there is not at least one anonymous argument given.
val maybe : 'a t -> 'a Base.option t(maybe anons) indicates that some anonymous arguments are optional.
(maybe_with_default default anons) indicates an optional anonymous argument with a default value.
t2, t3, and t4 each concatenate multiple anonymous argument specs into a single one. The purpose of these combinators is to allow for optional sequences of anonymous arguments. Consider a command with usage:
main.exe FOO [BAR BAZ]
where the second and third anonymous arguments must either both be there or both not be there. This can be expressed as:
t2 ("FOO" %: foo) (maybe (t2 ("BAR" %: bar) ("BAZ" %: baz)))]Sequences of 5 or more anonymous arguments can be built up using nested tuples:
maybe (t3 a b (t3 c d e))