提交 b162b49a 编写于 作者: H Hani Benhabiles 提交者: Luiz Capitulino

monitor: Add netdev_add type argument completion.

Also update the command's documentation.
Signed-off-by: NHani Benhabiles <hani@linux.com>
Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
上级 40d19394
......@@ -1234,9 +1234,10 @@ ETEXI
{
.name = "netdev_add",
.args_type = "netdev:O",
.params = "[user|tap|socket|hubport|netmap],id=str[,prop=value][,...]",
.params = "[user|tap|socket|vde|bridge|hubport|netmap],id=str[,prop=value][,...]",
.help = "add host network device",
.mhandler.cmd = hmp_netdev_add,
.command_completion = netdev_add_completion,
},
STEXI
......
......@@ -101,5 +101,6 @@ void sendkey_completion(ReadLineState *rs, int nb_args, const char *str);
void chardev_remove_completion(ReadLineState *rs, int nb_args, const char *str);
void chardev_add_completion(ReadLineState *rs, int nb_args, const char *str);
void set_link_completion(ReadLineState *rs, int nb_args, const char *str);
void netdev_add_completion(ReadLineState *rs, int nb_args, const char *str);
#endif
......@@ -4303,6 +4303,21 @@ void chardev_add_completion(ReadLineState *rs, int nb_args, const char *str)
qapi_free_ChardevBackendInfoList(start);
}
void netdev_add_completion(ReadLineState *rs, int nb_args, const char *str)
{
size_t len;
int i;
if (nb_args != 2) {
return;
}
len = strlen(str);
readline_set_completion_index(rs, len);
for (i = 0; NetClientOptionsKind_lookup[i]; i++) {
add_completion_option(rs, str, NetClientOptionsKind_lookup[i]);
}
}
void device_add_completion(ReadLineState *rs, int nb_args, const char *str)
{
GSList *list, *elt;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册