Received: from [140.186.70.92] (port=45797 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ORMtp-00010v-4G for qemu-devel@nongnu.org; Wed, 23 Jun 2010 06:09:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1ORMWB-0001ex-VS for qemu-devel@nongnu.org; Wed, 23 Jun 2010 05:45:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:24581) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ORMWB-0001ei-Ov for qemu-devel@nongnu.org; Wed, 23 Jun 2010 05:45:15 -0400 From: Markus Armbruster Subject: Re: [Qemu-devel] [PATCH v4 11/23] monitor: Add completion support for option lists References: <68962306385412f48130690d29a0349b322b9930.1276641524.git.jan.kiszka@web.de> Date: Wed, 23 Jun 2010 11:45:11 +0200 In-Reply-To: <68962306385412f48130690d29a0349b322b9930.1276641524.git.jan.kiszka@web.de> (Jan Kiszka's message of "Wed, 16 Jun 2010 00:38:35 +0200") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka Cc: Anthony Liguori , Juan Quintela , Jan Kiszka , qemu-devel@nongnu.org, Luiz Capitulino , Blue Swirl , Avi Kivity Jan Kiszka writes: > From: Jan Kiszka > > This enables command line completion inside option strings. A list of > expected key names and their completion type can be appended to the 'O' > inside parentheses ('O(key:type,...)'). The first use case is block > device completion for the 'drive' option of 'device_add'. > > Signed-off-by: Jan Kiszka > --- > monitor.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++--------- > qemu-monitor.hx | 2 +- > 2 files changed, 58 insertions(+), 12 deletions(-) > > diff --git a/monitor.c b/monitor.c > index c1006b4..3e0d862 100644 > --- a/monitor.c > +++ b/monitor.c > @@ -68,6 +68,9 @@ > * 'O' option string of the form NAME=VALUE,... > * parsed according to QemuOptsList given by its name > * Example: 'device:O' uses qemu_device_opts. > + * Command completion for specific keys can be requested via > + * appending '(NAME:TYPE,...)' with 'F', 'B' as type. > + * Example: 'device:O(bus:Q)' to expand 'bus=...' as qtree path. > * Restriction: only lists with empty desc are supported > * TODO lift the restriction > * 'i' 32 bit integer Ugh. Replacement of args_type by a proper data structure is long overdue. We keep piling features into that poor, hapless string. Information on how to complete QemuOptsList options arguably belongs into the option description, i.e. QemuOptDesc. [...]