From nobody Sat Feb 7 07:11:17 2026 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1710160176967595.9983669565778; Mon, 11 Mar 2024 05:29:36 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id B104C1EDB; Mon, 11 Mar 2024 08:29:35 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 29B241F4A; Mon, 11 Mar 2024 07:36:30 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 218DA1E56; Mon, 11 Mar 2024 07:32:26 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 02AB41DDE for ; Mon, 11 Mar 2024 07:31:24 -0400 (EDT) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-531-Eh86dItwMNeZtNP1kmmjvA-1; Mon, 11 Mar 2024 07:31:23 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CC53D380226B for ; Mon, 11 Mar 2024 11:31:22 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 448631121306 for ; Mon, 11 Mar 2024 11:31:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: Eh86dItwMNeZtNP1kmmjvA-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 21/23] vsh: Replace VSH_OT_DATA by VSH_OT_STRING Date: Mon, 11 Mar 2024 12:30:58 +0100 Message-ID: <44fdf5c4863abfcaf90b734dc904c8c2cdce4b10.1710156504.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: YQSTCU32BMBA5RUAIJDATPRTUKBVZDEF X-Message-ID-Hash: YQSTCU32BMBA5RUAIJDATPRTUKBVZDEF X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1710160178056100001 Use the new 'positional' field to do decisions rather than have a special type for positional strings. Signed-off-by: Peter Krempa --- 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 =3D { static const vshCmdOptDef opts_domif_getlink[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "interface", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -1039,7 +1039,7 @@ static const vshCmdInfo info_domifstat =3D { static const vshCmdOptDef opts_domifstat[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "interface", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D 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 =3D { static const vshCmdOptDef opts_attach_disk[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "source", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ | VSH_OFLAG_EMPTY_OK, .help =3D N_("source of disk device or name of network disk") }, {.name =3D "target", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -815,14 +815,14 @@ static const vshCmdInfo info_attach_interface =3D { static const vshCmdOptDef opts_attach_interface[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "type", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("network interface type") }, {.name =3D "source", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -1195,7 +1195,7 @@ static const vshCmdInfo info_blkdeviotune =3D { static const vshCmdOptDef opts_blkdeviotune[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "device", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -1990,7 +1990,7 @@ static const vshCmdInfo info_blockcommit =3D { static const vshCmdOptDef opts_blockcommit[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "path", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -2211,7 +2211,7 @@ static const vshCmdInfo info_blockcopy =3D { static const vshCmdOptDef opts_blockcopy[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "path", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -2545,7 +2545,7 @@ static const vshCmdInfo info_blockjob =3D { static const vshCmdOptDef opts_blockjob[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "path", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -2758,7 +2758,7 @@ static const vshCmdInfo info_blockpull =3D { static const vshCmdOptDef opts_blockpull[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "path", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -2902,7 +2902,7 @@ static const vshCmdInfo info_blockresize =3D { static const vshCmdOptDef opts_blockresize[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "path", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -3061,7 +3061,7 @@ static const vshCmdInfo info_domif_setlink =3D { static const vshCmdOptDef opts_domif_setlink[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "interface", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -3069,7 +3069,7 @@ static const vshCmdOptDef opts_domif_setlink[] =3D { .help =3D N_("interface device (MAC Address)") }, {.name =3D "state", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -3211,7 +3211,7 @@ static const vshCmdInfo info_domiftune =3D { static const vshCmdOptDef opts_domiftune[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "interface", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -3438,7 +3438,7 @@ static const vshCmdInfo info_dom_pm_suspend =3D { static const vshCmdOptDef opts_dom_pm_suspend[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_RUNNING), {.name =3D "target", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -4123,7 +4123,7 @@ static const vshCmdInfo info_save =3D { static const vshCmdOptDef opts_save[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "file", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -4474,7 +4474,7 @@ static const vshCmdInfo info_save_image_dumpxml =3D { static const vshCmdOptDef opts_save_image_dumpxml[] =3D { {.name =3D "file", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -4533,14 +4533,14 @@ static const vshCmdInfo info_save_image_define =3D { static const vshCmdOptDef opts_save_image_define[] =3D { {.name =3D "file", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("saved state file to modify") }, {.name =3D "xml", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -4600,7 +4600,7 @@ static const vshCmdInfo info_save_image_edit =3D { static const vshCmdOptDef opts_save_image_edit[] =3D { {.name =3D "file", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -4941,7 +4941,7 @@ static const vshCmdInfo info_managed_save_define =3D { static const vshCmdOptDef opts_managed_save_define[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_MANAGEDSAVE), {.name =3D "xml", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -5219,7 +5219,7 @@ static const vshCmdInfo info_restore =3D { static const vshCmdOptDef opts_restore[] =3D { {.name =3D "file", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -5304,7 +5304,7 @@ static const vshCmdInfo info_dump =3D { static const vshCmdOptDef opts_dump[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "file", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -5605,7 +5605,7 @@ static const vshCmdInfo info_setLifecycleAction =3D { static const vshCmdOptDef opts_setLifecycleAction[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "type", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -5613,7 +5613,7 @@ static const vshCmdOptDef opts_setLifecycleAction[] = =3D { .help =3D N_("lifecycle type to modify") }, {.name =3D "action", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -5701,14 +5701,14 @@ static const vshCmdInfo info_set_user_password =3D { static const vshCmdOptDef opts_set_user_password[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "user", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("the username") }, {.name =3D "password", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -7293,7 +7293,7 @@ static const vshCmdInfo info_setvcpu =3D { static const vshCmdOptDef opts_setvcpu[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "vcpulist", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -7369,7 +7369,7 @@ static const vshCmdInfo info_domblkthreshold =3D { static const vshCmdOptDef opts_domblkthreshold[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "dev", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -7509,7 +7509,7 @@ static const vshCmdOptDef opts_iothreadpin[] =3D { .help =3D N_("IOThread ID number") }, {.name =3D "cpulist", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -8365,7 +8365,7 @@ static const vshCmdInfo info_metadata =3D { static const vshCmdOptDef opts_metadata[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "uri", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -8630,7 +8630,7 @@ static const vshCmdInfo info_send_process_signal =3D { static const vshCmdOptDef opts_send_process_signal[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "pid", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -8638,7 +8638,7 @@ static const vshCmdOptDef opts_send_process_signal[] = =3D { .help =3D N_("the process ID") }, {.name =3D "signame", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -9574,7 +9574,7 @@ static const vshCmdInfo info_dom_fd_associate =3D { static const vshCmdOptDef opts_dom_fd_associate[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "name", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -9582,7 +9582,7 @@ static const vshCmdOptDef opts_dom_fd_associate[] =3D= { .help =3D N_("name of the FD group") }, {.name =3D "pass-fds", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -9996,7 +9996,7 @@ static const vshCmdInfo info_qemu_attach =3D { static const vshCmdOptDef opts_qemu_attach[] =3D { {.name =3D "pid", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -10332,14 +10332,14 @@ static const vshCmdInfo info_domxmlfromnative =3D= { static const vshCmdOptDef opts_domxmlfromnative[] =3D { {.name =3D "format", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, .help =3D N_("source config data format") }, {.name =3D "config", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -10384,7 +10384,7 @@ static const vshCmdInfo info_domxmltonative =3D { static const vshCmdOptDef opts_domxmltonative[] =3D { {.name =3D "format", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -10453,7 +10453,7 @@ static const vshCmdInfo info_domname =3D { static const vshCmdOptDef opts_domname[] =3D { {.name =3D "domain", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -10488,7 +10488,7 @@ static const vshCmdOptDef opts_domrename[] =3D { VIRSH_COMMON_OPT_DOMAIN(N_("domain name or uuid"), VIR_CONNECT_LIST_DOMAINS_INACTIVE), {.name =3D "new-name", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -10592,7 +10592,7 @@ static const vshCmdInfo info_migrate =3D { static const vshCmdOptDef opts_migrate[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "desturi", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -12002,7 +12002,7 @@ static const vshCmdInfo info_detach_device_alias = =3D { static const vshCmdOptDef opts_detach_device_alias[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "alias", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -12132,7 +12132,7 @@ static const vshCmdInfo info_detach_interface =3D { static const vshCmdOptDef opts_detach_interface[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "type", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -12506,7 +12506,7 @@ static const vshCmdInfo info_detach_disk =3D { static const vshCmdOptDef opts_detach_disk[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "target", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -12668,7 +12668,7 @@ static const vshCmdInfo info_change_media =3D { static const vshCmdOptDef opts_change_media[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(0), {.name =3D "path", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -13144,7 +13144,7 @@ static const vshCmdInfo info_get_user_sshkeys =3D { static const vshCmdOptDef opts_get_user_sshkeys[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "user", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -13193,7 +13193,7 @@ static const vshCmdInfo info_set_user_sshkeys =3D { static const vshCmdOptDef opts_set_user_sshkeys[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE), {.name =3D "user", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D 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 =3D { static const vshCmdOptDef opts_node_suspend[] =3D { {.name =3D "target", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -1277,7 +1277,7 @@ static const vshCmdInfo info_cpu_models =3D { static const vshCmdOptDef opts_cpu_models[] =3D { {.name =3D "arch", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .completer =3D 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 =3D "interface", \ - .type =3D VSH_OT_DATA, \ + .type =3D VSH_OT_STRING, \ .positional =3D true, \ .required =3D true, \ .flags =3D VSH_OFLAG_REQ, \ @@ -384,7 +384,7 @@ static const vshCmdInfo info_interface_name =3D { static const vshCmdOptDef opts_interface_name[] =3D { {.name =3D "interface", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -417,7 +417,7 @@ static const vshCmdInfo info_interface_mac =3D { static const vshCmdOptDef opts_interface_mac[] =3D { {.name =3D "interface", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -721,7 +721,7 @@ static const vshCmdInfo info_interface_bridge =3D { static const vshCmdOptDef opts_interface_bridge[] =3D { {.name =3D "interface", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -729,7 +729,7 @@ static const vshCmdOptDef opts_interface_bridge[] =3D { .help =3D N_("existing interface name") }, {.name =3D "bridge", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -952,7 +952,7 @@ static const vshCmdInfo info_interface_unbridge =3D { static const vshCmdOptDef opts_interface_unbridge[] =3D { {.name =3D "bridge", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D 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 =3D "network", \ - .type =3D VSH_OT_DATA,\ + .type =3D VSH_OT_STRING,\ .positional =3D true, \ .required =3D true, \ .flags =3D VSH_OFLAG_REQ, \ @@ -57,7 +57,7 @@ #define VIRSH_COMMON_OPT_NETWORK_PORT(cflags) \ {.name =3D "port", \ - .type =3D VSH_OT_DATA, \ + .type =3D VSH_OT_STRING, \ .positional =3D true, \ .required =3D true, \ .flags =3D VSH_OFLAG_REQ, \ @@ -523,7 +523,7 @@ static const vshCmdInfo info_network_metadata =3D { static const vshCmdOptDef opts_network_metadata[] =3D { VIRSH_COMMON_OPT_NETWORK_FULL(0), {.name =3D "uri", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -1150,7 +1150,7 @@ static const vshCmdInfo info_network_name =3D { static const vshCmdOptDef opts_network_name[] =3D { {.name =3D "network", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -1249,7 +1249,7 @@ static const vshCmdInfo info_network_update =3D { static const vshCmdOptDef opts_network_update[] =3D { VIRSH_COMMON_OPT_NETWORK_FULL(0), {.name =3D "command", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -1257,7 +1257,7 @@ static const vshCmdOptDef opts_network_update[] =3D { .help =3D N_("type of update (add-first, add-last (add), delete, or m= odify)") }, {.name =3D "section", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -1265,7 +1265,7 @@ static const vshCmdOptDef opts_network_update[] =3D { .help =3D N_("which section of network configuration to update") }, {.name =3D "xml", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D 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[] =3D { .help =3D "device" }, {.name =3D "device", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -572,7 +572,7 @@ static const vshCmdInfo info_node_device_dumpxml =3D { static const vshCmdOptDef opts_node_device_dumpxml[] =3D { {.name =3D "device", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -637,7 +637,7 @@ static const vshCmdInfo info_node_device_detach =3D { static const vshCmdOptDef opts_node_device_detach[] =3D { {.name =3D "device", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -701,7 +701,7 @@ static const vshCmdInfo info_node_device_reattach =3D { static const vshCmdOptDef opts_node_device_reattach[] =3D { {.name =3D "device", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -748,7 +748,7 @@ static const vshCmdInfo info_node_device_reset =3D { static const vshCmdOptDef opts_node_device_reset[] =3D { {.name =3D "device", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -1011,7 +1011,7 @@ static const vshCmdInfo info_node_device_undefine =3D= { static const vshCmdOptDef opts_node_device_undefine[] =3D { {.name =3D "device", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -1104,7 +1104,7 @@ static const vshCmdInfo info_node_device_start =3D { static const vshCmdOptDef opts_node_device_start[] =3D { {.name =3D "device", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -1151,7 +1151,7 @@ static const vshCmdInfo info_node_device_autostart = =3D { static const vshCmdOptDef opts_node_device_autostart[] =3D { {.name =3D "device", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -1210,7 +1210,7 @@ static const vshCmdInfo info_node_device_info =3D { static const vshCmdOptDef opts_node_device_info[] =3D { {.name =3D "device", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -1262,7 +1262,7 @@ static const vshCmdInfo info_node_device_update =3D { static const vshCmdOptDef opts_node_device_update[] =3D { {.name =3D "device", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D 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 =3D { static const vshCmdOptDef opts_nwfilter_undefine[] =3D { {.name =3D "nwfilter", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -168,7 +168,7 @@ static const vshCmdInfo info_nwfilter_dumpxml =3D { static const vshCmdOptDef opts_nwfilter_dumpxml[] =3D { {.name =3D "nwfilter", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -394,7 +394,7 @@ static const vshCmdInfo info_nwfilter_edit =3D { static const vshCmdOptDef opts_nwfilter_edit[] =3D { {.name =3D "nwfilter", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -531,7 +531,7 @@ static const vshCmdInfo info_nwfilter_binding_delete = =3D { static const vshCmdOptDef opts_nwfilter_binding_delete[] =3D { {.name =3D "binding", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -573,7 +573,7 @@ static const vshCmdInfo info_nwfilter_binding_dumpxml = =3D { static const vshCmdOptDef opts_nwfilter_binding_dumpxml[] =3D { {.name =3D "binding", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D 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 =3D "name", \ - .type =3D VSH_OT_DATA, \ + .type =3D VSH_OT_STRING, \ .positional =3D true, \ .required =3D true, \ .flags =3D VSH_OFLAG_REQ, \ @@ -65,7 +65,7 @@ .help =3D N_("name of the pool") \ }, \ {.name =3D "type", \ - .type =3D VSH_OT_DATA, \ + .type =3D VSH_OT_STRING, \ .positional =3D true, \ .required =3D true, \ .flags =3D VSH_OFLAG_REQ, \ @@ -1357,7 +1357,7 @@ static const vshCmdInfo info_find_storage_pool_source= s_as =3D { static const vshCmdOptDef opts_find_storage_pool_sources_as[] =3D { {.name =3D "type", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -1442,7 +1442,7 @@ static const vshCmdInfo info_find_storage_pool_source= s =3D { static const vshCmdOptDef opts_find_storage_pool_sources[] =3D { {.name =3D "type", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D 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 =3D { static const vshCmdOptDef opts_secret_dumpxml[] =3D { {.name =3D "secret", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -180,7 +180,7 @@ static const vshCmdInfo info_secret_set_value =3D { static const vshCmdOptDef opts_secret_set_value[] =3D { {.name =3D "secret", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -293,7 +293,7 @@ static const vshCmdInfo info_secret_get_value =3D { static const vshCmdOptDef opts_secret_get_value[] =3D { {.name =3D "secret", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -348,7 +348,7 @@ static const vshCmdInfo info_secret_undefine =3D { static const vshCmdOptDef opts_secret_undefine[] =3D { {.name =3D "secret", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D 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 =3D { static const vshCmdOptDef opts_snapshot_dumpxml[] =3D { VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_HAS_SNAPSHOT), {.name =3D "snapshotname", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D 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 =3D "vol", \ - .type =3D VSH_OT_DATA, \ + .type =3D VSH_OT_STRING, \ .positional =3D true, \ .required =3D true, \ .flags =3D VSH_OFLAG_REQ, \ @@ -66,7 +66,7 @@ #define VIRSH_COMMON_OPT_VOL_KEY(_helpstr) \ {.name =3D "vol", \ - .type =3D VSH_OT_DATA, \ + .type =3D VSH_OT_STRING, \ .positional =3D true, \ .required =3D true, \ .flags =3D VSH_OFLAG_REQ, \ @@ -176,7 +176,7 @@ static const vshCmdInfo info_vol_create_as =3D { static const vshCmdOptDef opts_vol_create_as[] =3D { VIRSH_COMMON_OPT_POOL_NAME, {.name =3D "name", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -184,7 +184,7 @@ static const vshCmdOptDef opts_vol_create_as[] =3D { .help =3D N_("name of the volume") }, {.name =3D "capacity", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -527,7 +527,7 @@ static const vshCmdInfo info_vol_clone =3D { static const vshCmdOptDef opts_vol_clone[] =3D { VIRSH_COMMON_OPT_VOL_FULL, {.name =3D "newname", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -1033,7 +1033,7 @@ static const vshCmdInfo info_vol_resize =3D { static const vshCmdOptDef opts_vol_resize[] =3D { VIRSH_COMMON_OPT_VOL_FULL, {.name =3D "capacity", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D 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 =3D "pool", \ - .type =3D VSH_OT_DATA,\ + .type =3D VSH_OT_STRING,\ .positional =3D true, \ .required =3D true, \ .flags =3D VSH_OFLAG_REQ, \ @@ -68,7 +68,7 @@ #define VIRSH_COMMON_OPT_DOMAIN(_helpstr, cflags) \ {.name =3D "domain", \ - .type =3D VSH_OT_DATA,\ + .type =3D VSH_OT_STRING,\ .positional =3D true, \ .required =3D true, \ .flags =3D VSH_OFLAG_REQ, \ @@ -104,7 +104,7 @@ #define VIRSH_COMMON_OPT_FILE_FULL(_helpstr, required_) \ {.name =3D "file", \ - .type =3D required_ ? VSH_OT_DATA : VSH_OT_STRING, \ + .type =3D VSH_OT_STRING, \ .required =3D required_, \ .positional =3D required_, \ .flags =3D 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 =3D { static const vshCmdOptDef opts_srv_threadpool_info[] =3D { {.name =3D "server", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -417,7 +417,7 @@ static const vshCmdInfo info_srv_threadpool_set =3D { static const vshCmdOptDef opts_srv_threadpool_set[] =3D { {.name =3D "server", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -520,7 +520,7 @@ static const vshCmdInfo info_srv_clients_list =3D { static const vshCmdOptDef opts_srv_clients_list[] =3D { {.name =3D "server", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -604,7 +604,7 @@ static const vshCmdInfo info_client_info =3D { static const vshCmdOptDef opts_client_info[] =3D { {.name =3D "server", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -612,7 +612,7 @@ static const vshCmdOptDef opts_client_info[] =3D { .help =3D N_("server to which is connected to"), }, {.name =3D "client", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -690,7 +690,7 @@ static const vshCmdInfo info_client_disconnect =3D { static const vshCmdOptDef opts_client_disconnect[] =3D { {.name =3D "server", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -755,7 +755,7 @@ static const vshCmdInfo info_srv_clients_info =3D { static const vshCmdOptDef opts_srv_clients_info[] =3D { {.name =3D "server", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -811,7 +811,7 @@ static const vshCmdInfo info_srv_clients_set =3D { static const vshCmdOptDef opts_srv_clients_set[] =3D { {.name =3D "server", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D VSH_OFLAG_REQ, @@ -910,7 +910,7 @@ static const vshCmdInfo info_srv_update_tls_file =3D { static const vshCmdOptDef opts_srv_update_tls_file[] =3D { {.name =3D "server", - .type =3D VSH_OT_DATA, + .type =3D VSH_OT_STRING, .positional =3D true, .required =3D true, .flags =3D 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 manda= tory */ + return -1; /* bool can't be mandatory */ } - seenOptionalOption =3D 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 list= ed 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 =3D !opt->required; break; } } @@ -575,7 +556,7 @@ vshCommandCheckOpts(vshControl *ctl, const vshCmd *cmd,= uint64_t opts_required, const vshCmdOptDef *opt =3D &def->opts[i]; vshError(ctl, - opt->type =3D=3D VSH_OT_DATA || opt->type =3D=3D 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 =3D g_strdup_printf(_("[--%1$s] "), 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; --=20 2.44.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org