nargs¶
nargs controls how many values an argument consumes.
Supported variants¶
AP_NARGS_ONEAP_NARGS_OPTIONALAP_NARGS_ZERO_OR_MOREAP_NARGS_ONE_OR_MOREAP_NARGS_FIXED
Optional argument behavior¶
AP_NARGS_ONE: requires exactly one valueAP_NARGS_OPTIONAL: accepts zero or one valueAP_NARGS_ZERO_OR_MORE: accepts zero or more valuesAP_NARGS_ONE_OR_MORE: accepts one or more valuesAP_NARGS_FIXED: requires exactlynargs_countvalues
Example¶
ap_arg_options files = ap_arg_options_default();
files.nargs = AP_NARGS_ONE_OR_MORE;
ap_add_argument(parser, "--files", files, &err);
Positional argument behavior¶
For positionals, tokens are assigned while preserving the minimum number of tokens required by later positional arguments.
See the English API Reference for the full contract.