The more traditional approach to option retrieval is to scan the
command-line for options in their order of appearance. Clon
supports
this by providing you with one function and two macros, as explained
below.
Get the next command-line option, that is, the first option on the command-line that has not been previously retrieved, either explicitely or sequentially.
When there are no more options on the command-line, this function returns
nil
. Otherwise, four values are returned: the corresponding
option object from the synopsis definition (see Constructors), the
name used on the command-line, the option’s value and the value source
(:cmdline
, :fallback
or :default
). As in the case
of explicit retrieval (see Explicit Retrieval), the option’s name
may be completed in case of abbreviation.
Unless you keep references to all your option objects (and thus can
compare them directly to the one returned by this function), you can
still identify the retrieved option by using the short-name
and
long-name
readers on it: simply use (long-name
OPTION)
or (short-name OPTION)
and you will get the
corresponding strings.
Evaluate BODY with OPTION, NAME, VALUE and
SOURCE bound to the values returned by the getopt-cmdline
function above. Note that BODY is not evaluated if there was no
remaining option on the command-line, so you don’t need to conditionalize
on OPTION being null
yourself.
As above, but loop over all command-line options.