monitor: Add object_del id argument completion.

Signed-off-by: Hani Benhabiles <hani@linux.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
This commit is contained in:
Hani Benhabiles 2014-02-06 23:30:12 +01:00 committed by Luiz Capitulino
parent 992d3e64c8
commit b48fa074b5

View File

@ -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: