From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59917) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WiAXD-0005HD-1s for qemu-devel@nongnu.org; Wed, 07 May 2014 18:42:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WiAX7-00034b-2t for qemu-devel@nongnu.org; Wed, 07 May 2014 18:41:54 -0400 Received: from mail-we0-x236.google.com ([2a00:1450:400c:c03::236]:54896) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WiAX6-00034I-S8 for qemu-devel@nongnu.org; Wed, 07 May 2014 18:41:49 -0400 Received: by mail-we0-f182.google.com with SMTP id t60so1717386wes.27 for ; Wed, 07 May 2014 15:41:48 -0700 (PDT) From: Hani Benhabiles Date: Wed, 7 May 2014 23:41:31 +0100 Message-Id: <1399502492-6188-6-git-send-email-kroosec@gmail.com> In-Reply-To: <1399502492-6188-1-git-send-email-kroosec@gmail.com> References: <1399502492-6188-1-git-send-email-kroosec@gmail.com> Subject: [Qemu-devel] [PATCH 5/6] monitor: Add netdev_add type argument completion. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kraxel@redhat.com, lcapitulino@redhat.com Also update the command's documentation. Signed-off-by: Hani Benhabiles --- 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 3e7b29c..a7f9b2f 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -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 diff --git a/hmp.h b/hmp.h index 91c9c85..bcecd0d 100644 --- a/hmp.h +++ b/hmp.h @@ -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 diff --git a/monitor.c b/monitor.c index 5ead568..a4c429c 100644 --- a/monitor.c +++ b/monitor.c @@ -4286,6 +4286,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