(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.
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))