[PATCH 05/23] vshCmddefCheckInternals: Fix listing of missing completers for 'VSH_OT_ARGV'

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

 



Use a switch statement to cover all cases and check for missing
completers for arguments declared as VSH_OT_ARGV.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 tools/vsh.c | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/tools/vsh.c b/tools/vsh.c
index 08a08bb227..6e558e56df 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -324,10 +324,24 @@ vshCmddefCheckInternals(vshControl *ctl,
             return -1; /* too many options */
         }

-        if (missingCompleters &&
-            (opt->type == VSH_OT_STRING || opt->type == VSH_OT_DATA) &&
-            !opt->completer)
-            virBufferStrcat(&complbuf, opt->name, ", ", NULL);
+        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;
+
+            case VSH_OT_BOOL:
+                /* only name is completed */
+            case VSH_OT_INT:
+                /* no point in completing numbers */
+            case VSH_OT_ALIAS:
+                /* alias is handled in the referenced command */
+            case VSH_OT_NONE:
+                break;
+            }
+        }

         switch (opt->type) {
         case VSH_OT_NONE:
-- 
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