Patchwork [V4,6/7] monitor: improve "help" in auto completion for sub command

login
register
mail settings
Submitter Wayne Xia
Date June 28, 2013, 3:39 a.m.
Message ID <1372390771-11157-7-git-send-email-xiawenc@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/255272/
State New
Headers show

Comments

Wayne Xia - June 28, 2013, 3:39 a.m.
Now special case "help *" in auto completion can work with sub commands,
such as "help info a*".

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

Patch

diff --git a/monitor.c b/monitor.c
index 5a66fb0..d07f6ec 100644
--- a/monitor.c
+++ b/monitor.c
@@ -4284,10 +4284,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 = mon->cmd_table; cmd->name != NULL; cmd++) {
-                    cmd_completion(mon, str, cmd->name);
-                }
+                monitor_find_completion_by_table(mon, cmd_table,
+                                                 args_cmdline[1]);
             }
             break;
         default: