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(a)redhat.com>
---
tools/virsh-domain-monitor.c | 3 +++
tools/virsh-domain.c | 6 ++++++
2 files changed, 9 insertions(+)
diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
index 6c2499fb9f..71a5086c00 100644
--- a/tools/virsh-domain-monitor.c
+++ b/tools/virsh-domain-monitor.c
@@ -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")},
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index d7b86ded7d..9a41e32e3d 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -2939,6 +2939,7 @@ static const vshCmdOptDef opts_blockresize[] = {
},
{.name = "size",
.type = VSH_OT_INT,
+ .positional = true,
.help = N_("New size of the block device, as scaled integer (default
KiB)")
},
{.name = "capacity",
@@ -5805,6 +5806,7 @@ static const vshCmdOptDef opts_shutdown[] = {
VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
{.name = "mode",
.type = VSH_OT_STRING,
+ .positional = true,
.completer = virshDomainShutdownModeCompleter,
.help = N_("shutdown mode: acpi|agent|initctl|signal|paravirt")
},
@@ -5880,6 +5882,7 @@ static const vshCmdOptDef opts_reboot[] = {
VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
{.name = "mode",
.type = VSH_OT_STRING,
+ .positional = true,
.completer = virshDomainShutdownModeCompleter,
.help = N_("shutdown mode: acpi|agent|initctl|signal|paravirt")
},
@@ -11531,6 +11534,7 @@ static const vshCmdOptDef opts_domdisplay[] = {
},
{.name = "type",
.type = VSH_OT_STRING,
+ .positional = true,
.help = N_("select particular graphical display "
"(e.g. \"vnc\", \"spice\", \"rdp\",
\"dbus\")")
},
@@ -12675,6 +12679,7 @@ static const vshCmdOptDef opts_change_media[] = {
},
{.name = "source",
.type = VSH_OT_STRING,
+ .positional = true,
.help = N_("source of the media")
},
{.name = "eject",
@@ -13199,6 +13204,7 @@ static const vshCmdOptDef opts_set_user_sshkeys[] = {
},
{.name = "file",
.type = VSH_OT_STRING,
+ .positional = true,
.completer = virshCompletePathLocalExisting,
.help = N_("optional file to read keys from"),
},
--
2.44.0