From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34603) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUDSG-0008Ev-Uv for qemu-devel@nongnu.org; Sun, 30 Mar 2014 06:59:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WUDSB-0003WT-0C for qemu-devel@nongnu.org; Sun, 30 Mar 2014 06:59:08 -0400 Received: from mail-ee0-x231.google.com ([2a00:1450:4013:c00::231]:38848) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUDSA-0003WJ-Q4 for qemu-devel@nongnu.org; Sun, 30 Mar 2014 06:59:02 -0400 Received: by mail-ee0-f49.google.com with SMTP id c41so5570696eek.8 for ; Sun, 30 Mar 2014 03:59:02 -0700 (PDT) From: Hani Benhabiles Date: Sun, 30 Mar 2014 11:58:30 +0100 Message-Id: <1396177119-24955-9-git-send-email-kroosec@gmail.com> In-Reply-To: <1396177119-24955-1-git-send-email-kroosec@gmail.com> References: <1396177119-24955-1-git-send-email-kroosec@gmail.com> Subject: [Qemu-devel] [PATCH v2 08/17] 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: kwolf@redhat.com, aliguori@amazon.com, lcapitulino@redhat.com, stefanha@redhat.com, imammedo@redhat.com Also update the command's documentation. Signed-off-by: Hani Benhabiles --- hmp-commands.hx | 3 ++- hmp.h | 1 + monitor.c | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index fbd303a..b009561 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1226,9 +1226,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 33a883d..9dab1a3 100644 --- a/hmp.h +++ b/hmp.h @@ -101,5 +101,6 @@ 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 cpu_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 009f269..5293370 100644 --- a/monitor.c +++ b/monitor.c @@ -4312,6 +4312,24 @@ 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; + + if (nb_args != 2) { + return; + } + len = strlen(str); + readline_set_completion_index(rs, len); + add_completion_option(rs, str, "user"); + add_completion_option(rs, str, "tap"); + add_completion_option(rs, str, "socket"); + add_completion_option(rs, str, "vde"); + add_completion_option(rs, str, "bridge"); + add_completion_option(rs, str, "hubport"); + add_completion_option(rs, str, "netmap"); +} + void device_add_completion(ReadLineState *rs, int nb_args, const char *str) { GSList *list, *elt; -- 1.8.3.2