aboutsummaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
authorDr. David Alan Gilbert <dgilbert@redhat.com>2018-06-20 16:39:43 +0100
committerDr. David Alan Gilbert <dgilbert@redhat.com>2018-06-21 12:49:02 +0100
commit6d9f7839b7e6c364536d22beb2ca1277772813a6 (patch)
treea82d2a7b7cabc0f65237c6e947742a9e40f9aa91 /monitor.c
parent31785f1b030b62ec84e1c852eaeeabbae1232345 (diff)
downloadqemu-6d9f7839b7e6c364536d22beb2ca1277772813a6.zip
qemu-6d9f7839b7e6c364536d22beb2ca1277772813a6.tar.gz
qemu-6d9f7839b7e6c364536d22beb2ca1277772813a6.tar.bz2
hmp: Restrict auto-complete in preconfig
Don't show the commands that aren't available. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Message-Id: <20180620153947.30834-4-dgilbert@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/monitor.c b/monitor.c
index 18c2207..068c094 100644
--- a/monitor.c
+++ b/monitor.c
@@ -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;
}
}