]> xenbits.xensource.com Git - libvirt.git/commit
vsh: Annotate 'required' and 'positional' arguments explicitly
authorPeter Krempa <pkrempa@redhat.com>
Tue, 5 Mar 2024 14:07:47 +0000 (15:07 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 13 Mar 2024 14:02:52 +0000 (15:02 +0100)
commitac150162fd6287a0a79f335b75e7ca2e11d2dfb5
tree73e7ff8f3ac2ecea553ea8530f1bf3458e0fab19
parent162b184d0e3c369f784a600c960d4ead7323605a
vsh: Annotate 'required' and 'positional' arguments explicitly

Add 'positional' and 'required' fields to vshCmdOptDef, which will
explicitly track the two properties of arguments.

To ensure that we have proper coverage, add checks to
vshCmddefCheckInternals validating the state of the above flags by
infering it from existing data.

This conversion will allow us:
 - remove VSH_OT_DATA in favor of VSH_OT_STRING
 - use VSH_OT_INT when required both as positional and non-positional
 - properly annotate which VSH_OT_ARGV are positional and which are not
   (currently inferred by whether an previous positional option exists)

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
15 files changed:
tools/virsh-domain-monitor.c
tools/virsh-domain.c
tools/virsh-host.c
tools/virsh-interface.c
tools/virsh-network.c
tools/virsh-nodedev.c
tools/virsh-nwfilter.c
tools/virsh-pool.c
tools/virsh-secret.c
tools/virsh-snapshot.c
tools/virsh-volume.c
tools/virsh.h
tools/virt-admin.c
tools/vsh.c
tools/vsh.h