Also update the command's documentation. Signed-off-by: Hani Benhabiles <h...@linux.com> --- hmp-commands.hx | 3 ++- hmp.h | 1 + monitor.c | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/hmp-commands.hx b/hmp-commands.hx index 353161f..73fbe54 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1227,9 +1227,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 diff --git a/hmp.h b/hmp.h index dec29c7..7b85834 100644 --- a/hmp.h +++ b/hmp.h @@ -102,5 +102,6 @@ void help_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 diff --git a/monitor.c b/monitor.c index c7ad78c..cc6d01b 100644 --- a/monitor.c +++ b/monitor.c @@ -4312,6 +4312,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; -- 1.8.3.2