virsh: Annotate some optional arguments as positional

Make certain optional arguments truly positional in cases when it makes
semantic sense.

Previously it wasn't possible to have optional positional arguments, but
the parser filled them regardless, thus this preserves functionality.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa
2024-03-14 17:13:05 +01:00
parent d19b12a681
commit 1304ef40a9
2 changed files with 9 additions and 0 deletions

View File

@@ -385,6 +385,7 @@ static const vshCmdOptDef opts_domblkinfo[] = {
VIRSH_COMMON_OPT_DOMAIN_FULL(0),
{.name = "device",
.type = VSH_OT_STRING,
.positional = true,
.completer = virshDomainDiskTargetCompleter,
.help = N_("block device")
},
@@ -865,6 +866,7 @@ static const vshCmdOptDef opts_domblkstat[] = {
{.name = "device",
.type = VSH_OT_STRING,
.flags = VSH_OFLAG_EMPTY_OK,
.positional = true,
.completer = virshDomainDiskTargetCompleter,
.help = N_("block device")
},
@@ -2219,6 +2221,7 @@ static const vshCmdOptDef opts_domifaddr[] = {
VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
{.name = "interface",
.type = VSH_OT_STRING,
.positional = true,
.flags = VSH_OFLAG_NONE,
.completer = virshDomainInterfaceCompleter,
.help = N_("network interface name")},