[PATCH v2 3/3] virsh: Complete multiple options when any one option requires data

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

 



Before this patch:
    virsh # start --domain dom1 [TAB][TAB] <- offers filename completion
    virsh # start --domain [TAB][TAB] <- offers filename completion

After this patch:
    virsh # start --domain dom1 [TAB][TAB] <- offers command completion
    virsh # start --domain [TAB][TAB] <- calls domain completer if
    defined, otherwise falls back to filename completion

Signed-off-by: Nishith Shah <nishithshah.2211@xxxxxxxxx>
---
 tools/vsh.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/vsh.c b/tools/vsh.c
index 45f55d9..3157922 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -2731,6 +2731,7 @@ vshReadlineParse(const char *text, int state)
                     goto error;
                 }
 
+                opts_seen = const_opts_seen;
                 opt_exists = true;
                 VIR_FREE(const_tkdata);
                 if (opt->type != VSH_OT_BOOL) {
@@ -2748,14 +2749,14 @@ vshReadlineParse(const char *text, int state)
                             goto error;
 
                         tkdata = const_tkdata;
+                        virSkipSpaces((const char **)&tkdata);
                     }
                     if (STREQ(tkdata, sanitized_text)) {
                         /* auto-complete non-bool option arg */
                         data_complete = true;
                         break;
                     }
-                    if (opt->type != VSH_OT_ARGV)
-                        opts_need_arg &= ~(1ULL << opt_index);
+                    non_bool_opt_exists = false;
                 } else {
                     tkdata = NULL;
                     /* opt type is BOOL */
-- 
2.1.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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]