[PATCH 16/23] vsh: Fix broken assumption that required VSH_OT_INT must be positional

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

 



In at least one case we've wanted a mandatory argument which requires
the explicit flag. Fix the assumption before converting everything over
to the new flags.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 tools/virt-admin.c | 1 -
 tools/vsh.c        | 9 +++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/tools/virt-admin.c b/tools/virt-admin.c
index d266d824cb..2e8895956d 100644
--- a/tools/virt-admin.c
+++ b/tools/virt-admin.c
@@ -1011,7 +1011,6 @@ static const vshCmdInfo info_daemon_log_outputs = {
 static const vshCmdOptDef opts_daemon_timeout[] = {
     {.name = "timeout",
      .type = VSH_OT_INT,
-     .positional = true,
      .required = true,
      .help = N_("number of seconds the daemon will run without any active connection"),
      .flags = VSH_OFLAG_REQ | VSH_OFLAG_REQ_OPT
diff --git a/tools/vsh.c b/tools/vsh.c
index 9745c122fe..7091cf093c 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -426,9 +426,14 @@ vshCmddefCheckInternals(vshControl *ctl,
                              opt->name, cmd->name);
                     return -1;
                 }
-                seenPositionalOption = true;
-                isPositional = true;
+
                 isRequired = true;
+
+                /* allow INT arguments which are required and non-positional */
+                if (!(opt->flags & VSH_OFLAG_REQ_OPT)) {
+                    seenPositionalOption = true;
+                    isPositional = true;
+                }
             } else {
                 isPositional = false;
                 isRequired = false;
-- 
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