mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
vsh: Replace VSH_OT_DATA by VSH_OT_STRING
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>
This commit is contained in:
parent
36132ff984
commit
cce3e049a9
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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, \
|
||||
|
@ -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,
|
||||
|
33
tools/vsh.c
33
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 {
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user