]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
vsh: Replace VSH_OT_DATA by VSH_OT_STRING
authorPeter Krempa <pkrempa@redhat.com>
Tue, 5 Mar 2024 15:07:36 +0000 (16:07 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 13 Mar 2024 14:02:52 +0000 (15:02 +0100)
Use the new 'positional' field to do decisions rather than have a
special type for positional strings.

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

index 573451c678474e2ad7cba679fd90d6611a639f84..568ff770a1834b8d87150406e5bc0bbfd39bc63f 100644 (file)
@@ -737,7 +737,7 @@ static const vshCmdInfo info_domif_getlink = {
 static const vshCmdOptDef opts_domif_getlink[] = {
     VIRSH_COMMON_OPT_DOMAIN_FULL(0),
     {.name = "interface",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -1039,7 +1039,7 @@ static const vshCmdInfo info_domifstat = {
 static const vshCmdOptDef opts_domifstat[] = {
     VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
     {.name = "interface",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
index 063a5145214e13522eb120c962c42fc72da4e9d6..7799975c2aaa9ee2616bf4e2d4d5b1d000aada79 100644 (file)
@@ -419,14 +419,14 @@ static const vshCmdInfo info_attach_disk = {
 static const vshCmdOptDef opts_attach_disk[] = {
     VIRSH_COMMON_OPT_DOMAIN_FULL(0),
     {.name = "source",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ | VSH_OFLAG_EMPTY_OK,
      .help = N_("source of disk device or name of network disk")
     },
     {.name = "target",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -815,14 +815,14 @@ static const vshCmdInfo info_attach_interface = {
 static const vshCmdOptDef opts_attach_interface[] = {
     VIRSH_COMMON_OPT_DOMAIN_FULL(0),
     {.name = "type",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
      .help = N_("network interface type")
     },
     {.name = "source",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -1195,7 +1195,7 @@ static const vshCmdInfo info_blkdeviotune = {
 static const vshCmdOptDef opts_blkdeviotune[] = {
     VIRSH_COMMON_OPT_DOMAIN_FULL(0),
     {.name = "device",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -1990,7 +1990,7 @@ static const vshCmdInfo info_blockcommit = {
 static const vshCmdOptDef opts_blockcommit[] = {
     VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
     {.name = "path",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -2211,7 +2211,7 @@ static const vshCmdInfo info_blockcopy = {
 static const vshCmdOptDef opts_blockcopy[] = {
     VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
     {.name = "path",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -2545,7 +2545,7 @@ static const vshCmdInfo info_blockjob = {
 static const vshCmdOptDef opts_blockjob[] = {
     VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
     {.name = "path",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -2758,7 +2758,7 @@ static const vshCmdInfo info_blockpull = {
 static const vshCmdOptDef opts_blockpull[] = {
     VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
     {.name = "path",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -2902,7 +2902,7 @@ static const vshCmdInfo info_blockresize = {
 static const vshCmdOptDef opts_blockresize[] = {
     VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
     {.name = "path",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -3061,7 +3061,7 @@ static const vshCmdInfo info_domif_setlink = {
 static const vshCmdOptDef opts_domif_setlink[] = {
     VIRSH_COMMON_OPT_DOMAIN_FULL(0),
     {.name = "interface",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -3069,7 +3069,7 @@ static const vshCmdOptDef opts_domif_setlink[] = {
      .help = N_("interface device (MAC Address)")
     },
     {.name = "state",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -3211,7 +3211,7 @@ static const vshCmdInfo info_domiftune = {
 static const vshCmdOptDef opts_domiftune[] = {
     VIRSH_COMMON_OPT_DOMAIN_FULL(0),
     {.name = "interface",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -3438,7 +3438,7 @@ static const vshCmdInfo info_dom_pm_suspend = {
 static const vshCmdOptDef opts_dom_pm_suspend[] = {
     VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_RUNNING),
     {.name = "target",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -4123,7 +4123,7 @@ static const vshCmdInfo info_save = {
 static const vshCmdOptDef opts_save[] = {
     VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
     {.name = "file",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -4474,7 +4474,7 @@ static const vshCmdInfo info_save_image_dumpxml = {
 
 static const vshCmdOptDef opts_save_image_dumpxml[] = {
     {.name = "file",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -4533,14 +4533,14 @@ static const vshCmdInfo info_save_image_define = {
 
 static const vshCmdOptDef opts_save_image_define[] = {
     {.name = "file",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
      .help = N_("saved state file to modify")
     },
     {.name = "xml",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -4600,7 +4600,7 @@ static const vshCmdInfo info_save_image_edit = {
 
 static const vshCmdOptDef opts_save_image_edit[] = {
     {.name = "file",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -4941,7 +4941,7 @@ static const vshCmdInfo info_managed_save_define = {
 static const vshCmdOptDef opts_managed_save_define[] = {
     VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_MANAGEDSAVE),
     {.name = "xml",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -5219,7 +5219,7 @@ static const vshCmdInfo info_restore = {
 
 static const vshCmdOptDef opts_restore[] = {
     {.name = "file",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -5304,7 +5304,7 @@ static const vshCmdInfo info_dump = {
 static const vshCmdOptDef opts_dump[] = {
     VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
     {.name = "file",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -5605,7 +5605,7 @@ static const vshCmdInfo info_setLifecycleAction = {
 static const vshCmdOptDef opts_setLifecycleAction[] = {
     VIRSH_COMMON_OPT_DOMAIN_FULL(0),
     {.name = "type",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -5613,7 +5613,7 @@ static const vshCmdOptDef opts_setLifecycleAction[] = {
      .help = N_("lifecycle type to modify")
     },
     {.name = "action",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -5701,14 +5701,14 @@ static const vshCmdInfo info_set_user_password = {
 static const vshCmdOptDef opts_set_user_password[] = {
     VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
     {.name = "user",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
      .help = N_("the username")
     },
     {.name = "password",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -7293,7 +7293,7 @@ static const vshCmdInfo info_setvcpu = {
 static const vshCmdOptDef opts_setvcpu[] = {
     VIRSH_COMMON_OPT_DOMAIN_FULL(0),
     {.name = "vcpulist",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -7369,7 +7369,7 @@ static const vshCmdInfo info_domblkthreshold = {
 static const vshCmdOptDef opts_domblkthreshold[] = {
     VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
     {.name = "dev",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -7509,7 +7509,7 @@ static const vshCmdOptDef opts_iothreadpin[] = {
      .help = N_("IOThread ID number")
     },
     {.name = "cpulist",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -8346,7 +8346,7 @@ static const vshCmdInfo info_metadata = {
 static const vshCmdOptDef opts_metadata[] = {
     VIRSH_COMMON_OPT_DOMAIN_FULL(0),
     {.name = "uri",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -8611,7 +8611,7 @@ static const vshCmdInfo info_send_process_signal = {
 static const vshCmdOptDef opts_send_process_signal[] = {
     VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
     {.name = "pid",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -8619,7 +8619,7 @@ static const vshCmdOptDef opts_send_process_signal[] = {
      .help = N_("the process ID")
     },
     {.name = "signame",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -9555,7 +9555,7 @@ static const vshCmdInfo info_dom_fd_associate = {
 static const vshCmdOptDef opts_dom_fd_associate[] = {
     VIRSH_COMMON_OPT_DOMAIN_FULL(0),
     {.name = "name",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -9563,7 +9563,7 @@ static const vshCmdOptDef opts_dom_fd_associate[] = {
      .help = N_("name of the FD group")
     },
     {.name = "pass-fds",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -9977,7 +9977,7 @@ static const vshCmdInfo info_qemu_attach = {
 
 static const vshCmdOptDef opts_qemu_attach[] = {
     {.name = "pid",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -10313,14 +10313,14 @@ static const vshCmdInfo info_domxmlfromnative = {
 
 static const vshCmdOptDef opts_domxmlfromnative[] = {
     {.name = "format",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
      .help = N_("source config data format")
     },
     {.name = "config",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -10365,7 +10365,7 @@ static const vshCmdInfo info_domxmltonative = {
 
 static const vshCmdOptDef opts_domxmltonative[] = {
     {.name = "format",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -10434,7 +10434,7 @@ static const vshCmdInfo info_domname = {
 
 static const vshCmdOptDef opts_domname[] = {
     {.name = "domain",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -10469,7 +10469,7 @@ static const vshCmdOptDef opts_domrename[] = {
     VIRSH_COMMON_OPT_DOMAIN(N_("domain name or uuid"),
                             VIR_CONNECT_LIST_DOMAINS_INACTIVE),
     {.name = "new-name",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -10573,7 +10573,7 @@ static const vshCmdInfo info_migrate = {
 static const vshCmdOptDef opts_migrate[] = {
     VIRSH_COMMON_OPT_DOMAIN_FULL(0),
     {.name = "desturi",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -11983,7 +11983,7 @@ static const vshCmdInfo info_detach_device_alias = {
 static const vshCmdOptDef opts_detach_device_alias[] = {
     VIRSH_COMMON_OPT_DOMAIN_FULL(0),
     {.name = "alias",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -12113,7 +12113,7 @@ static const vshCmdInfo info_detach_interface = {
 static const vshCmdOptDef opts_detach_interface[] = {
     VIRSH_COMMON_OPT_DOMAIN_FULL(0),
     {.name = "type",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -12487,7 +12487,7 @@ static const vshCmdInfo info_detach_disk = {
 static const vshCmdOptDef opts_detach_disk[] = {
     VIRSH_COMMON_OPT_DOMAIN_FULL(0),
     {.name = "target",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -12649,7 +12649,7 @@ static const vshCmdInfo info_change_media = {
 static const vshCmdOptDef opts_change_media[] = {
     VIRSH_COMMON_OPT_DOMAIN_FULL(0),
     {.name = "path",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -13125,7 +13125,7 @@ static const vshCmdInfo info_get_user_sshkeys = {
 static const vshCmdOptDef opts_get_user_sshkeys[] = {
     VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
     {.name = "user",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -13174,7 +13174,7 @@ static const vshCmdInfo info_set_user_sshkeys = {
 static const vshCmdOptDef opts_set_user_sshkeys[] = {
     VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
     {.name = "user",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
index 368e6565504a813288430290f1ab86d9d91472d6..97de6f8bed0f4de0d81c3bc0e9dcacb9ce92bcf0 100644 (file)
@@ -946,7 +946,7 @@ static const vshCmdInfo info_nodesuspend = {
 
 static const vshCmdOptDef opts_node_suspend[] = {
     {.name = "target",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -1277,7 +1277,7 @@ static const vshCmdInfo info_cpu_models = {
 
 static const vshCmdOptDef opts_cpu_models[] = {
     {.name = "arch",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .completer = virshArchCompleter,
index 52dce97462e5c3ce21ff8e08ccb85d9dab6310da..109378ca716f3f5919fb7c9c6544a24348e23460 100644 (file)
@@ -20,7 +20,7 @@
 
 #define VIRSH_COMMON_OPT_INTERFACE(cflags) \
     {.name = "interface", \
-     .type = VSH_OT_DATA, \
+     .type = VSH_OT_STRING, \
      .positional = true, \
      .required = true, \
      .flags = VSH_OFLAG_REQ, \
@@ -384,7 +384,7 @@ static const vshCmdInfo info_interface_name = {
 
 static const vshCmdOptDef opts_interface_name[] = {
     {.name = "interface",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -417,7 +417,7 @@ static const vshCmdInfo info_interface_mac = {
 
 static const vshCmdOptDef opts_interface_mac[] = {
     {.name = "interface",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -721,7 +721,7 @@ static const vshCmdInfo info_interface_bridge = {
 
 static const vshCmdOptDef opts_interface_bridge[] = {
     {.name = "interface",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -729,7 +729,7 @@ static const vshCmdOptDef opts_interface_bridge[] = {
      .help = N_("existing interface name")
     },
     {.name = "bridge",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -952,7 +952,7 @@ static const vshCmdInfo info_interface_unbridge = {
 
 static const vshCmdOptDef opts_interface_unbridge[] = {
     {.name = "bridge",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
index b12efdce36e761524892603ed8c08c6cd416c363..f393522d9911d85f01edb6a34e38a86e7a25415e 100644 (file)
@@ -32,7 +32,7 @@
 
 #define VIRSH_COMMON_OPT_NETWORK(_helpstr, cflags) \
     {.name = "network", \
-     .type = VSH_OT_DATA, \
+     .type = VSH_OT_STRING, \
      .positional = true, \
      .required = true, \
      .flags = VSH_OFLAG_REQ, \
@@ -57,7 +57,7 @@
 
 #define VIRSH_COMMON_OPT_NETWORK_PORT(cflags) \
     {.name = "port", \
-     .type = VSH_OT_DATA, \
+     .type = VSH_OT_STRING, \
      .positional = true, \
      .required = true, \
      .flags = VSH_OFLAG_REQ, \
@@ -505,7 +505,7 @@ static const vshCmdInfo info_network_metadata = {
 static const vshCmdOptDef opts_network_metadata[] = {
     VIRSH_COMMON_OPT_NETWORK_FULL(0),
     {.name = "uri",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -1132,7 +1132,7 @@ static const vshCmdInfo info_network_name = {
 
 static const vshCmdOptDef opts_network_name[] = {
     {.name = "network",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -1231,7 +1231,7 @@ static const vshCmdInfo info_network_update = {
 static const vshCmdOptDef opts_network_update[] = {
     VIRSH_COMMON_OPT_NETWORK_FULL(0),
     {.name = "command",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -1239,7 +1239,7 @@ static const vshCmdOptDef opts_network_update[] = {
      .help = N_("type of update (add-first, add-last (add), delete, or modify)")
     },
     {.name = "section",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -1247,7 +1247,7 @@ static const vshCmdOptDef opts_network_update[] = {
      .help = N_("which section of network configuration to update")
     },
     {.name = "xml",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
index 0081e3cbb727aeb894f551f2461386945b052cb3..7d635814364136397ab8f900565b6dc572ef9149 100644 (file)
@@ -96,7 +96,7 @@ static const vshCmdOptDef opts_node_device_destroy[] = {
      .help = "device"
     },
     {.name = "device",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -572,7 +572,7 @@ static const vshCmdInfo info_node_device_dumpxml = {
 
 static const vshCmdOptDef opts_node_device_dumpxml[] = {
     {.name = "device",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -637,7 +637,7 @@ static const vshCmdInfo info_node_device_detach = {
 
 static const vshCmdOptDef opts_node_device_detach[] = {
     {.name = "device",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -701,7 +701,7 @@ static const vshCmdInfo info_node_device_reattach = {
 
 static const vshCmdOptDef opts_node_device_reattach[] = {
     {.name = "device",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -748,7 +748,7 @@ static const vshCmdInfo info_node_device_reset = {
 
 static const vshCmdOptDef opts_node_device_reset[] = {
     {.name = "device",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -1011,7 +1011,7 @@ static const vshCmdInfo info_node_device_undefine = {
 
 static const vshCmdOptDef opts_node_device_undefine[] = {
     {.name = "device",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -1104,7 +1104,7 @@ static const vshCmdInfo info_node_device_start = {
 
 static const vshCmdOptDef opts_node_device_start[] = {
     {.name = "device",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -1151,7 +1151,7 @@ static const vshCmdInfo info_node_device_autostart = {
 
 static const vshCmdOptDef opts_node_device_autostart[] = {
     {.name = "device",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -1210,7 +1210,7 @@ static const vshCmdInfo info_node_device_info = {
 
 static const vshCmdOptDef opts_node_device_info[] = {
     {.name = "device",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -1262,7 +1262,7 @@ static const vshCmdInfo info_node_device_update = {
 
 static const vshCmdOptDef opts_node_device_update[] = {
     {.name = "device",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
index 993539d368e9f453ebc9e342902369829ded1899..faa8e981300bc049ed50b3332ca00290ff13b53d 100644 (file)
@@ -128,7 +128,7 @@ static const vshCmdInfo info_nwfilter_undefine = {
 
 static const vshCmdOptDef opts_nwfilter_undefine[] = {
     {.name = "nwfilter",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -168,7 +168,7 @@ static const vshCmdInfo info_nwfilter_dumpxml = {
 
 static const vshCmdOptDef opts_nwfilter_dumpxml[] = {
     {.name = "nwfilter",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -394,7 +394,7 @@ static const vshCmdInfo info_nwfilter_edit = {
 
 static const vshCmdOptDef opts_nwfilter_edit[] = {
     {.name = "nwfilter",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -531,7 +531,7 @@ static const vshCmdInfo info_nwfilter_binding_delete = {
 
 static const vshCmdOptDef opts_nwfilter_binding_delete[] = {
     {.name = "binding",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -573,7 +573,7 @@ static const vshCmdInfo info_nwfilter_binding_dumpxml = {
 
 static const vshCmdOptDef opts_nwfilter_binding_dumpxml[] = {
     {.name = "binding",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
index 46069908361d88d804dda1f43006e599d14ce148..8557e0d5e0f321cb74cfcff0a3d2709563637b9a 100644 (file)
@@ -57,7 +57,7 @@
 
 #define VIRSH_COMMON_OPT_POOL_X_AS \
     {.name = "name", \
-     .type = VSH_OT_DATA, \
+     .type = VSH_OT_STRING, \
      .positional = true, \
      .required = true, \
      .flags = VSH_OFLAG_REQ, \
@@ -65,7 +65,7 @@
      .help = N_("name of the pool") \
     }, \
     {.name = "type", \
-     .type = VSH_OT_DATA, \
+     .type = VSH_OT_STRING, \
      .positional = true, \
      .required = true, \
      .flags = VSH_OFLAG_REQ, \
@@ -1357,7 +1357,7 @@ static const vshCmdInfo info_find_storage_pool_sources_as = {
 
 static const vshCmdOptDef opts_find_storage_pool_sources_as[] = {
     {.name = "type",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -1442,7 +1442,7 @@ static const vshCmdInfo info_find_storage_pool_sources = {
 
 static const vshCmdOptDef opts_find_storage_pool_sources[] = {
     {.name = "type",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
index d7e60de4cad22870d6fb78d59776522d19108d22..0d0db9877b3eb9ea5f563a4b78432c9079852c97 100644 (file)
@@ -123,7 +123,7 @@ static const vshCmdInfo info_secret_dumpxml = {
 
 static const vshCmdOptDef opts_secret_dumpxml[] = {
     {.name = "secret",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -180,7 +180,7 @@ static const vshCmdInfo info_secret_set_value = {
 
 static const vshCmdOptDef opts_secret_set_value[] = {
     {.name = "secret",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -293,7 +293,7 @@ static const vshCmdInfo info_secret_get_value = {
 
 static const vshCmdOptDef opts_secret_get_value[] = {
     {.name = "secret",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -348,7 +348,7 @@ static const vshCmdInfo info_secret_undefine = {
 
 static const vshCmdOptDef opts_secret_undefine[] = {
     {.name = "secret",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
index 9ad33c4252dc8e655dcb86e9287cfa40d1eba3ad..9658fdefcdc9b43cd5b367ecc411999e6bb29bf7 100644 (file)
@@ -1567,7 +1567,7 @@ static const vshCmdInfo info_snapshot_dumpxml = {
 static const vshCmdOptDef opts_snapshot_dumpxml[] = {
     VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_HAS_SNAPSHOT),
     {.name = "snapshotname",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
index ecf89345c35afd590337b2f62545997e839d057e..90a450ad146f8c8da1a06403def10e369bfb692f 100644 (file)
@@ -56,7 +56,7 @@
 
 #define VIRSH_COMMON_OPT_VOL_NAME(_helpstr) \
     {.name = "vol", \
-     .type = VSH_OT_DATA, \
+     .type = VSH_OT_STRING, \
      .positional = true, \
      .required = true, \
      .flags = VSH_OFLAG_REQ, \
@@ -66,7 +66,7 @@
 
 #define VIRSH_COMMON_OPT_VOL_KEY(_helpstr) \
     {.name = "vol", \
-     .type = VSH_OT_DATA, \
+     .type = VSH_OT_STRING, \
      .positional = true, \
      .required = true, \
      .flags = VSH_OFLAG_REQ, \
@@ -176,7 +176,7 @@ static const vshCmdInfo info_vol_create_as = {
 static const vshCmdOptDef opts_vol_create_as[] = {
     VIRSH_COMMON_OPT_POOL_NAME,
     {.name = "name",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -184,7 +184,7 @@ static const vshCmdOptDef opts_vol_create_as[] = {
      .help = N_("name of the volume")
     },
     {.name = "capacity",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -527,7 +527,7 @@ static const vshCmdInfo info_vol_clone = {
 static const vshCmdOptDef opts_vol_clone[] = {
     VIRSH_COMMON_OPT_VOL_FULL,
     {.name = "newname",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -1033,7 +1033,7 @@ static const vshCmdInfo info_vol_resize = {
 static const vshCmdOptDef opts_vol_resize[] = {
     VIRSH_COMMON_OPT_VOL_FULL,
     {.name = "capacity",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
index 451683769de3b381a1074b9f53d94e9274efa1c4..2a68ef80bc0e08e253156309aba29e562927ed0f 100644 (file)
@@ -57,7 +57,7 @@
  */
 #define VIRSH_COMMON_OPT_POOL(_helpstr, cflags) \
     {.name = "pool", \
-     .type = VSH_OT_DATA, \
+     .type = VSH_OT_STRING, \
      .positional = true, \
      .required = true, \
      .flags = VSH_OFLAG_REQ, \
@@ -68,7 +68,7 @@
 
 #define VIRSH_COMMON_OPT_DOMAIN(_helpstr, cflags) \
     {.name = "domain", \
-     .type = VSH_OT_DATA, \
+     .type = VSH_OT_STRING, \
      .positional = true, \
      .required = true, \
      .flags = VSH_OFLAG_REQ, \
 
 #define VIRSH_COMMON_OPT_FILE_FULL(_helpstr, required_) \
     {.name = "file", \
-     .type = required_ ? VSH_OT_DATA : VSH_OT_STRING, \
+     .type = VSH_OT_STRING, \
      .required = required_, \
      .positional = required_, \
      .flags = required_ ? VSH_OFLAG_REQ : VSH_OFLAG_NONE, \
index 2e8895956d56e9c6a6fce3ca3c724bb0e6c298ed..d1191161244138a5f250106263f95a0b118015bd 100644 (file)
@@ -358,7 +358,7 @@ static const vshCmdInfo info_srv_threadpool_info = {
 
 static const vshCmdOptDef opts_srv_threadpool_info[] = {
     {.name = "server",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -417,7 +417,7 @@ static const vshCmdInfo info_srv_threadpool_set = {
 
 static const vshCmdOptDef opts_srv_threadpool_set[] = {
     {.name = "server",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -520,7 +520,7 @@ static const vshCmdInfo info_srv_clients_list = {
 
 static const vshCmdOptDef opts_srv_clients_list[] = {
     {.name = "server",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -604,7 +604,7 @@ static const vshCmdInfo info_client_info = {
 
 static const vshCmdOptDef opts_client_info[] = {
     {.name = "server",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -612,7 +612,7 @@ static const vshCmdOptDef opts_client_info[] = {
      .help = N_("server to which <client> is connected to"),
     },
     {.name = "client",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -690,7 +690,7 @@ static const vshCmdInfo info_client_disconnect = {
 
 static const vshCmdOptDef opts_client_disconnect[] = {
     {.name = "server",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -755,7 +755,7 @@ static const vshCmdInfo info_srv_clients_info = {
 
 static const vshCmdOptDef opts_srv_clients_info[] = {
     {.name = "server",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -811,7 +811,7 @@ static const vshCmdInfo info_srv_clients_set = {
 
 static const vshCmdOptDef opts_srv_clients_set[] = {
     {.name = "server",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
@@ -910,7 +910,7 @@ static const vshCmdInfo info_srv_update_tls_file = {
 
 static const vshCmdOptDef opts_srv_update_tls_file[] = {
     {.name = "server",
-     .type = VSH_OT_DATA,
+     .type = VSH_OT_STRING,
      .positional = true,
      .required = true,
      .flags = VSH_OFLAG_REQ,
index b640a7a833de31bc63dd9c7368fb4185d6adaade..81807b1f8bc03f875846f06a78f47136ff1e0248 100644 (file)
@@ -310,7 +310,6 @@ vshCmddefCheckInternals(vshControl *ctl,
         if (missingCompleters && !opt->completer) {
             switch (opt->type) {
             case VSH_OT_STRING:
-            case VSH_OT_DATA:
             case VSH_OT_ARGV:
                 virBufferStrcat(&complbuf, opt->name, ", ", NULL);
                 break;
@@ -346,16 +345,12 @@ vshCmddefCheckInternals(vshControl *ctl,
                 return -1;
             }
 
-            G_GNUC_FALLTHROUGH;
-
-        case VSH_OT_STRING:
             if (opt->flags & VSH_OFLAG_REQ) {
                 vshError(ctl, "parameter '%s' of command '%s' misused VSH_OFLAG_REQ",
                          opt->name, cmd->name);
-                return -1; /* neither bool nor string options can be mandatory */
+                return -1; /* bool can't be mandatory */
             }
 
-            seenOptionalOption = true;
             break;
 
         case VSH_OT_ALIAS: {
@@ -401,29 +396,15 @@ vshCmddefCheckInternals(vshControl *ctl,
             }
             break;
 
-        case VSH_OT_DATA:
-            if (!(opt->flags & VSH_OFLAG_REQ)) {
-                vshError(ctl, "parameter '%s' of command '%s' must use VSH_OFLAG_REQ flag",
-                         opt->name, cmd->name);
-                return -1;
-            }
-
-            if (seenOptionalOption) {
+        case VSH_OT_INT:
+        case VSH_OT_STRING:
+            if (opt->positional && seenOptionalOption) {
                 vshError(ctl, "parameter '%s' of command '%s' must be listed before optional parameters",
                          opt->name, cmd->name);
                 return -1;
             }
-            break;
-
-        case VSH_OT_INT:
-            if (opt->flags & VSH_OFLAG_REQ) {
-                if (seenOptionalOption) {
-                    vshError(ctl, "parameter '%s' of command '%s' must be listed before optional parameters",
-                             opt->name, cmd->name);
-                    return -1;
-                }
-            }
 
+            seenOptionalOption = !opt->required;
             break;
         }
     }
@@ -575,7 +556,7 @@ vshCommandCheckOpts(vshControl *ctl, const vshCmd *cmd, uint64_t opts_required,
             const vshCmdOptDef *opt = &def->opts[i];
 
             vshError(ctl,
-                     opt->type == VSH_OT_DATA || opt->type == VSH_OT_ARGV ?
+                     opt->positional ?
                      _("command '%1$s' requires <%2$s> option") :
                      _("command '%1$s' requires --%2$s option"),
                      def->name, opt->name);
@@ -649,7 +630,6 @@ vshCmddefHelp(const vshCmdDef *def)
                 break;
 
             case VSH_OT_STRING:
-            case VSH_OT_DATA:
             case VSH_OT_INT:
                 if (opt->required) {
                     fprintf(stdout, " ");
@@ -722,7 +702,6 @@ vshCmddefHelp(const vshCmdDef *def)
                 break;
 
             case VSH_OT_STRING:
-            case VSH_OT_DATA:
                 if (opt->positional) {
                     optstr = g_strdup_printf(_("[--%1$s] <string>"), opt->name);
                 } else {
index 53384dbb55a9b11bceeeaaa535d33d5a475ba0bd..7eb73a929d9e6e8ae7d24e0090ce1a2ade8c8452 100644 (file)
@@ -89,7 +89,6 @@ typedef enum {
     VSH_OT_BOOL,     /* optional boolean option */
     VSH_OT_STRING,   /* optional string option */
     VSH_OT_INT,      /* optional or mandatory int option */
-    VSH_OT_DATA,     /* string data (as non-option) */
     VSH_OT_ARGV,     /* remaining arguments */
     VSH_OT_ALIAS,    /* alternate spelling for a later argument */
 } vshCmdOptType;