summaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
authorHani Benhabiles <kroosec@gmail.com>2014-02-06 23:30:12 +0100
committerLuiz Capitulino <lcapitulino@redhat.com>2014-02-17 11:57:23 -0500
commitb48fa074b565131bd0782d122d54c001acfed86f (patch)
tree93f00c1a01542b5b7ba7cc08e1a202a38a122f06 /monitor.c
parent992d3e64c89bd2af1ae005080636e8da43c1b500 (diff)
downloadqemu-b48fa074b565131bd0782d122d54c001acfed86f.tar.gz
qemu-b48fa074b565131bd0782d122d54c001acfed86f.tar.bz2
qemu-b48fa074b565131bd0782d122d54c001acfed86f.zip
monitor: Add object_del id argument completion.
Signed-off-by: Hani Benhabiles <hani@linux.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/monitor.c b/monitor.c
index 4ffe44d0d3..5b863c9f83 100644
--- a/monitor.c
+++ b/monitor.c
@@ -4294,6 +4294,27 @@ static void device_del_completion(ReadLineState *rs, BusState *bus,
}
}
+static void object_del_completion(ReadLineState *rs, const char *str)
+{
+ ObjectPropertyInfoList *list, *start;
+ size_t len;
+
+ len = strlen(str);
+ readline_set_completion_index(rs, len);
+
+ start = list = qmp_qom_list("/objects", NULL);
+ while (list) {
+ ObjectPropertyInfo *info = list->value;
+
+ if (!strncmp(info->type, "child<", 5)
+ && !strncmp(info->name, str, len)) {
+ readline_add_completion(rs, info->name);
+ }
+ list = list->next;
+ }
+ qapi_free_ObjectPropertyInfoList(start);
+}
+
static void monitor_find_completion_by_table(Monitor *mon,
const mon_cmd_t *cmd_table,
char **args,
@@ -4379,6 +4400,8 @@ static void monitor_find_completion_by_table(Monitor *mon,
size_t len = strlen(str);
readline_set_completion_index(mon->rs, len);
device_del_completion(mon->rs, sysbus_get_default(), str, len);
+ } else if (!strcmp(cmd->name, "object_del") && nb_args == 2) {
+ object_del_completion(mon->rs, str);
}
break;
default: