On a Friday in 2024, Peter Krempa wrote:
Part 2 was supposed to be the refactor of the parser, but it turns
out
that our annotations of arguments and quirks of the parser itself
resulted with basically every optional argument with value being also
considered for positional parisng.
This series explains where this happens and annotates all cases.
Peter Krempa (28):
vshCmddefHelp: Drop empty line at the end
virsh: cmdDomdisplayReload: Require option name for --type
vshCmddefCheckInternals: Improve some checks
virsh: Inline VIRSH_COMMON_OPT_DOMAIN_OT_STRING macro
virsh: Inline VIRSH_COMMON_OPT_FILE_FULL macro
virsh: Inline VIRSH_COMMON_OPT_NETWORK_OT_STRING macro
vsh: Introduce tool to find unwanted positional arguments to
'self-test'
vsh: Introduce annotation for vsh options which are unexpectedly
parsed positionally
virsh: Annotate '--diskspec' _ARGV options as unwanted positional
virsh: Annotate rest of _ARGV arguments as positional
vsh: Fix option formatting for 'VHS_OT_ARGV' options
virsh: Require option flags for 'blkdeviotune' arguments
virsh: Fix "positional" argument annotations for 'migrate' command
virsh: Require option flags for all optional arguments of
'attach-disk'
virsh-checkpoint: Make 'checkpointname' positional and required
vsh: Allow one optional positional argument
vsh: Make the only argument of 'connect', 'cd', and 'help'
commands
positional
virsh: snapshot: Make 'snapshotname' argument positional
virsh: Make '(snapshot|checkpoint)-create' 'xmlfile' argument
positional
virsh-backup: Fix argument annotations of 'backup-begin' command
virsh: Annotate some optional arguments as positional
virsh: volume: Mark optional 'pool' argument as 'positional'
virsh: Annotate "unwanted_positional" arguments for
'pool-(define|create)-as' commands
virsh: Annodate 'unwanted_positional' arguments
virt-admin: Annodate 'unwanted_positional' arguments
vsh: Make positional parsing of arguments opt-in
vsh: Replace 'VSH_OFLAG_EMPTY_OK' bitwise flag with a separate struct
member
vshCmdOptDef: Remove unused 'flags' member
tools/virsh-backup.c | 3 +-
tools/virsh-checkpoint.c | 26 ++++---
tools/virsh-domain-event.c | 10 ++-
tools/virsh-domain-monitor.c | 11 +--
tools/virsh-domain.c | 134 ++++++++++++++++++++++++++++-------
tools/virsh-host.c | 33 +++++++--
tools/virsh-interface.c | 2 +-
tools/virsh-network.c | 28 ++++----
tools/virsh-nodedev.c | 6 +-
tools/virsh-nwfilter.c | 2 -
tools/virsh-pool.c | 31 ++++++--
tools/virsh-secret.c | 6 +-
tools/virsh-snapshot.c | 13 +++-
tools/virsh-volume.c | 12 +++-
tools/virsh.c | 3 +-
tools/virsh.h | 20 +-----
tools/virt-admin.c | 15 ++--
tools/vsh.c | 64 +++++++++++++----
tools/vsh.h | 18 +++--
19 files changed, 316 insertions(+), 121 deletions(-)
Reviewed-by: Ján Tomko <jtomko(a)redhat.com>
Jano