From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42638) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCyKa-0000wf-3y for qemu-devel@nongnu.org; Mon, 10 Feb 2014 16:24:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WCyKU-0005cv-6K for qemu-devel@nongnu.org; Mon, 10 Feb 2014 16:23:56 -0500 Received: from mail-ee0-f41.google.com ([74.125.83.41]:44386) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCyKU-0005cg-0h for qemu-devel@nongnu.org; Mon, 10 Feb 2014 16:23:50 -0500 Received: by mail-ee0-f41.google.com with SMTP id e51so2751802eek.0 for ; Mon, 10 Feb 2014 13:23:13 -0800 (PST) Date: Mon, 10 Feb 2014 22:23:02 +0100 From: Hani Benhabiles Message-ID: <20140210212302.GA3883@Inspiron-3521> References: <1390602475-19621-1-git-send-email-kroosec@gmail.com> <20140210144913.456c62ee@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140210144913.456c62ee@redhat.com> Subject: Re: [Qemu-devel] [PATCH] monitor: Add device_add type argument completion. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: qemu-devel@nongnu.org Hi Luiz, Thanks for taking a look at it. On Mon, Feb 10, 2014 at 02:49:13PM -0500, Luiz Capitulino wrote: > On Fri, 24 Jan 2014 23:27:55 +0100 > Hani Benhabiles wrote: > > > Signed-off-by: Hani Benhabiles > > --- > > 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 > > Will show all device names once again. > > > + } > > + break; > > case 's': > > case 'S': > > if (!strcmp(cmd->name, "sendkey")) { > I fixed the issue in these patch series: http://lists.gnu.org/archive/html/qemu-devel/2014-02/msg00891.html Could you please take a look at it ? Cheers, Hani.