提交 6d9f7839 编写于 作者: D Dr. David Alan Gilbert

hmp: Restrict auto-complete in preconfig

Don't show the commands that aren't available.
Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: NPeter Xu <peterx@redhat.com>
Reviewed-by: NIgor Mammedov <imammedo@redhat.com>
Message-Id: <20180620153947.30834-4-dgilbert@redhat.com>
Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
上级 31785f1b
......@@ -4020,12 +4020,17 @@ static void monitor_find_completion_by_table(Monitor *mon,
cmdname = args[0];
readline_set_completion_index(mon->rs, strlen(cmdname));
for (cmd = cmd_table; cmd->name != NULL; cmd++) {
cmd_completion(mon, cmdname, cmd->name);
if (!runstate_check(RUN_STATE_PRECONFIG) ||
cmd_can_preconfig(cmd)) {
cmd_completion(mon, cmdname, cmd->name);
}
}
} else {
/* find the command */
for (cmd = cmd_table; cmd->name != NULL; cmd++) {
if (compare_cmd(args[0], cmd->name)) {
if (compare_cmd(args[0], cmd->name) &&
(!runstate_check(RUN_STATE_PRECONFIG) ||
cmd_can_preconfig(cmd))) {
break;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册