[PATCH 21/23] vsh: Replace VSH_OT_DATA by VSH_OT_STRING

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use the new 'positional' field to do decisions rather than have a
special type for positional strings.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 tools/virsh-domain-monitor.c |  4 +-
 tools/virsh-domain.c         | 94 ++++++++++++++++++------------------
 tools/virsh-host.c           |  4 +-
 tools/virsh-interface.c      | 12 ++---
 tools/virsh-network.c        | 14 +++---
 tools/virsh-nodedev.c        | 20 ++++----
 tools/virsh-nwfilter.c       | 10 ++--
 tools/virsh-pool.c           |  8 +--
 tools/virsh-secret.c         |  8 +--
 tools/virsh-snapshot.c       |  2 +-
 tools/virsh-volume.c         | 12 ++---
 tools/virsh.h                |  6 +--
 tools/virt-admin.c           | 18 +++----
 tools/vsh.c                  | 33 +++----------
 tools/vsh.h                  |  1 -
 15 files changed, 112 insertions(+), 134 deletions(-)

diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
index 573451c678..568ff770a1 100644
--- a/tools/virsh-domain-monitor.c
+++ b/tools/virsh-domain-monitor.c
@@ -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,
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 7a63757131..1dbef9a7a6 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -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,
@@ -8365,7 +8365,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,
@@ -8630,7 +8630,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,
@@ -8638,7 +8638,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,
@@ -9574,7 +9574,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,
@@ -9582,7 +9582,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,
@@ -9996,7 +9996,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,
@@ -10332,14 +10332,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,
@@ -10384,7 +10384,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,
@@ -10453,7 +10453,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,
@@ -10488,7 +10488,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,
@@ -10592,7 +10592,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,
@@ -12002,7 +12002,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,
@@ -12132,7 +12132,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,
@@ -12506,7 +12506,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,
@@ -12668,7 +12668,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,
@@ -13144,7 +13144,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,
@@ -13193,7 +13193,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,
diff --git a/tools/virsh-host.c b/tools/virsh-host.c
index 368e656550..97de6f8bed 100644
--- a/tools/virsh-host.c
+++ b/tools/virsh-host.c
@@ -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,
diff --git a/tools/virsh-interface.c b/tools/virsh-interface.c
index 52dce97462..109378ca71 100644
--- a/tools/virsh-interface.c
+++ b/tools/virsh-interface.c
@@ -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,
diff --git a/tools/virsh-network.c b/tools/virsh-network.c
index b9db3e061d..edbcebd682 100644
--- a/tools/virsh-network.c
+++ b/tools/virsh-network.c
@@ -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, \
@@ -523,7 +523,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,
@@ -1150,7 +1150,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,
@@ -1249,7 +1249,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,
@@ -1257,7 +1257,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,
@@ -1265,7 +1265,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,
diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c
index 0081e3cbb7..7d63581436 100644
--- a/tools/virsh-nodedev.c
+++ b/tools/virsh-nodedev.c
@@ -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,
diff --git a/tools/virsh-nwfilter.c b/tools/virsh-nwfilter.c
index 993539d368..faa8e98130 100644
--- a/tools/virsh-nwfilter.c
+++ b/tools/virsh-nwfilter.c
@@ -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,
diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c
index 4606990836..8557e0d5e0 100644
--- a/tools/virsh-pool.c
+++ b/tools/virsh-pool.c
@@ -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,
diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c
index d7e60de4ca..0d0db9877b 100644
--- a/tools/virsh-secret.c
+++ b/tools/virsh-secret.c
@@ -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,
diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c
index 9ad33c4252..9658fdefcd 100644
--- a/tools/virsh-snapshot.c
+++ b/tools/virsh-snapshot.c
@@ -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,
diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c
index ecf89345c3..90a450ad14 100644
--- a/tools/virsh-volume.c
+++ b/tools/virsh-volume.c
@@ -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,
diff --git a/tools/virsh.h b/tools/virsh.h
index 3e8d998a5d..b009ed5854 100644
--- a/tools/virsh.h
+++ b/tools/virsh.h
@@ -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, \
@@ -104,7 +104,7 @@

 #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, \
diff --git a/tools/virt-admin.c b/tools/virt-admin.c
index 2e8895956d..d119116124 100644
--- a/tools/virt-admin.c
+++ b/tools/virt-admin.c
@@ -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,
diff --git a/tools/vsh.c b/tools/vsh.c
index c7257586e3..7e8fbf8050 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -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 {
diff --git a/tools/vsh.h b/tools/vsh.h
index d2591e93a6..73b908a5f2 100644
--- a/tools/vsh.h
+++ b/tools/vsh.h
@@ -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;
-- 
2.44.0
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux