From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54333) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WmWYg-0005cP-Ir for qemu-devel@nongnu.org; Mon, 19 May 2014 19:01:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WmWYa-0005kk-KK for qemu-devel@nongnu.org; Mon, 19 May 2014 19:01:26 -0400 Received: from mail-wg0-x22c.google.com ([2a00:1450:400c:c00::22c]:45557) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WmWYa-0005kV-De for qemu-devel@nongnu.org; Mon, 19 May 2014 19:01:20 -0400 Received: by mail-wg0-f44.google.com with SMTP id a1so8429213wgh.3 for ; Mon, 19 May 2014 16:01:19 -0700 (PDT) From: Hani Benhabiles Date: Tue, 20 May 2014 00:01:03 +0100 Message-Id: <1400540468-1177-3-git-send-email-kroosec@gmail.com> In-Reply-To: <1400540468-1177-1-git-send-email-kroosec@gmail.com> References: <1400540468-1177-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 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