Patchwork [V10,15/15] monitor: improve auto complete of "help" for single command in sub group

login
register
mail settings
Submitter Wayne Xia
Date Aug. 27, 2013, 12:38 p.m.
Message ID <1377607107-11612-16-git-send-email-xiawenc@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/270117/
State New
Headers show

Comments

Wayne Xia - Aug. 27, 2013, 12:38 p.m.
Now special case "help *" in auto completion can work with sub commands,
such as "help info u*".

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
 monitor.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

Patch

diff --git a/monitor.c b/monitor.c
index 81f41e6..8d07f9c 100644
--- a/monitor.c
+++ b/monitor.c
@@ -4329,10 +4329,8 @@  static void monitor_find_completion_by_table(Monitor *mon,
                     cmd_completion(mon, str, QKeyCode_lookup[i]);
                 }
             } else if (!strcmp(cmd->name, "help|?")) {
-                readline_set_completion_index(mon->rs, strlen(str));
-                for (cmd = cmd_table; cmd->name != NULL; cmd++) {
-                    cmd_completion(mon, str, cmd->name);
-                }
+                monitor_find_completion_by_table(mon, cmd_table,
+                                                 &args[1], nb_args - 1);
             }
             break;
         default: