diff options
| author | Tomas Glozar <tglozar@redhat.com> | 2026-05-28 12:32:50 +0200 |
|---|---|---|
| committer | Tomas Glozar <tglozar@redhat.com> | 2026-05-28 13:02:47 +0200 |
| commit | 534d9a93dbff2f964a85aef7a7fbfba82d2277bb (patch) | |
| tree | 4d5f16ea6402aef6941cedeab19ed611a1a9a109 /include | |
| parent | 48209d763c22354c78f6138f4a83814c2f2a3578 (diff) | |
tools subcmd: support optarg as separate argument
In addition to "-ovalue" and "--opt=value" syntax, allow also "-o value"
and "--opt value" for options with optional argument when the newly
added PARSE_OPT_OPTARG_ALLOW_NEXT flag is set.
This behavior is turned off by default since it does not make sense for
tools using non-option command line arguments. Consider the ambiguity
of "cmd -d x", where "-d x" can mean either "-d with argument of x" or
"-d without argument, followed by non-option argument x". This is not an
issue in the case that the tool takes no non-option arguments.
To implement this, a new local variable, force_defval, is created in
get_value(), along with a comment explaining the logic.
Link: https://lore.kernel.org/r/20260528103254.2990068-3-tglozar@redhat.com
Signed-off-by: Tomas Glozar <tglozar@redhat.com>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions
