7.5.6.11 Option Argument Optional
The arg-optional
attribute indicates that the argument to the option is
optional (need not be specified on the command line). This is only valid if
the arg-type is string
(see Arg Type String) or
keyword
(see Arg Type Keyword). If it is keyword
, then this
attribute may also specify the default keyword to assume when the argument is
not supplied. If left empty, arg-default (see Default Option Argument Value) or the
zero-valued keyword will be used.
The syntax rules for identifying the option argument are:
- If the option is specified with a flag character and there is a character
following the flag character, then string following that flag character is the
option argument.
- If the flag character is the last character in an argument, then
the first character of the next argument is examined. If it is a hyphen,
then the option is presumed to not have an argument. Otherwise, the entire
next argument is the argument for the option.
- If the option is specified with a long option name and that name is ended with
an equal sign character (
=
), then everything after that character is the
option argument.
- If the long name is ended by the end of the argument, then the first character
of the next argument is examined, just as with the flag character ending an
argument string.
This is overridden and the options are required if the libopts library
gets configured with --disable-optional-args.