From: Luiz Capitulino <lcapitulino@redhat.com>
To: Hani Benhabiles <kroosec@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] monitor: Add device_add type argument completion.
Date: Mon, 10 Feb 2014 14:49:13 -0500 [thread overview]
Message-ID: <20140210144913.456c62ee@redhat.com> (raw)
In-Reply-To: <1390602475-19621-1-git-send-email-kroosec@gmail.com>
On Fri, 24 Jan 2014 23:27:55 +0100
Hani Benhabiles <kroosec@gmail.com> wrote:
> Signed-off-by: Hani Benhabiles <kroosec@gmail.com>
> ---
> monitor.c | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/monitor.c b/monitor.c
> index 845f608..cf91544 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -4254,6 +4254,26 @@ static const char *next_arg_type(const char *typestr)
> return (p != NULL ? ++p : typestr);
> }
>
> +static void device_add_completion(ReadLineState *rs, const char *str)
> +{
> + GSList *list, *elt;
> + size_t len;
> + len = strlen(str);
> + readline_set_completion_index(rs, len);
> + list = elt = object_class_get_list(TYPE_DEVICE, false);
> + while (elt) {
> + const char *name;
> + DeviceClass *dc = OBJECT_CLASS_CHECK(DeviceClass, elt->data,
> + TYPE_DEVICE);
> + name = object_class_get_name(OBJECT_CLASS(dc));
> + if (!strncmp(name, str, len)) {
> + readline_add_completion(rs, name);
> + }
> + elt = elt->next;
> + }
> + g_slist_free(list);
> +}
> +
> static void monitor_find_completion_by_table(Monitor *mon,
> const mon_cmd_t *cmd_table,
> char **args,
> @@ -4317,6 +4337,11 @@ static void monitor_find_completion_by_table(Monitor *mon,
> readline_set_completion_index(mon->rs, strlen(str));
> bdrv_iterate(block_completion_it, &mbs);
> break;
> + case 'O':
> + if (!strcmp(cmd->name, "device_add")) {
> + device_add_completion(mon->rs, str);
This is nice, but it keeps printing auto-completion options even after
it has auto-completed. For example:
(qemu) device_add pcnet <TAB>
Will show all device names once again.
> + }
> + break;
> case 's':
> case 'S':
> if (!strcmp(cmd->name, "sendkey")) {
next prev parent reply other threads:[~2014-02-10 19:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-24 22:27 [Qemu-devel] [PATCH] monitor: Add device_add type argument completion Hani Benhabiles
2014-02-10 19:49 ` Luiz Capitulino [this message]
2014-02-10 21:23 ` Hani Benhabiles
2014-02-10 21:26 ` Luiz Capitulino
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140210144913.456c62ee@redhat.com \
--to=lcapitulino@redhat.com \
--cc=kroosec@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).