]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsh: Annotate some optional arguments as positional
authorPeter Krempa <pkrempa@redhat.com>
Thu, 14 Mar 2024 16:13:05 +0000 (17:13 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 2 Apr 2024 12:24:29 +0000 (14:24 +0200)
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>
tools/virsh-domain-monitor.c
tools/virsh-domain.c

index 6c2499fb9f341f0a23aac82bfcfcac611c3a89f8..71a5086c00686f1b876e5a7eab00f3c77401be94 100644 (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")},
index d7b86ded7db9594c811184e3a671e0f735303d00..9a41e32e3da0ff98915ab283547dc1c700106695 100644 (file)
@@ -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"),
     },