From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54958) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WmWax-0000x0-9f for qemu-devel@nongnu.org; Mon, 19 May 2014 19:03:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WmWap-0006cX-3c for qemu-devel@nongnu.org; Mon, 19 May 2014 19:03:47 -0400 Received: from mail-we0-x22a.google.com ([2a00:1450:400c:c03::22a]:55096) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WmWao-0006cF-Tn for qemu-devel@nongnu.org; Mon, 19 May 2014 19:03:39 -0400 Received: by mail-we0-f170.google.com with SMTP id u57so6296225wes.29 for ; Mon, 19 May 2014 16:03:38 -0700 (PDT) From: Hani Benhabiles Date: Tue, 20 May 2014 00:03:15 +0100 Message-Id: <1400540600-1328-3-git-send-email-kroosec@gmail.com> In-Reply-To: <1400540600-1328-1-git-send-email-kroosec@gmail.com> References: <1400540600-1328-1-git-send-email-kroosec@gmail.com> Subject: [Qemu-devel] [PATCH 2/7] monitor: Add watchdog_action argument completion. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, mdroth@linux.vnet.ibm.com, lcapitulino@redhat.com, stefanha@redhat.com, imammedo@redhat.com Signed-off-by: Hani Benhabiles --- hmp-commands.hx | 1 + hmp.h | 2 ++ monitor.c | 14 ++++++++++++++ 3 files changed, 17 insertions(+) diff --git a/hmp-commands.hx b/hmp-commands.hx index dcec5ef..45e1763 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1359,6 +1359,7 @@ ETEXI .params = "[reset|shutdown|poweroff|pause|debug|none]", .help = "change watchdog action", .mhandler.cmd = do_watchdog_action, + .command_completion = watchdog_action_completion, }, STEXI diff --git a/hmp.h b/hmp.h index 212e5d2..a70804d 100644 --- a/hmp.h +++ b/hmp.h @@ -105,5 +105,7 @@ void netdev_add_completion(ReadLineState *rs, int nb_args, const char *str); void netdev_del_completion(ReadLineState *rs, int nb_args, const char *str); void ringbuf_write_completion(ReadLineState *rs, int nb_args, const char *str); void ringbuf_read_completion(ReadLineState *rs, int nb_args, const char *str); +void watchdog_action_completion(ReadLineState *rs, int nb_args, + const char *str); #endif diff --git a/monitor.c b/monitor.c index 93eb6d8..fb300c2 100644 --- a/monitor.c +++ b/monitor.c @@ -4558,6 +4558,20 @@ void netdev_del_completion(ReadLineState *rs, int nb_args, const char *str) } } +void watchdog_action_completion(ReadLineState *rs, int nb_args, const char *str) +{ + if (nb_args != 2) { + return; + } + readline_set_completion_index(rs, strlen(str)); + add_completion_option(rs, str, "reset"); + add_completion_option(rs, str, "shutdown"); + add_completion_option(rs, str, "poweroff"); + add_completion_option(rs, str, "pause"); + add_completion_option(rs, str, "debug"); + add_completion_option(rs, str, "none"); +} + static void monitor_find_completion_by_table(Monitor *mon, const mon_cmd_t *cmd_table, char **args, -- 1.8.3.2