From: "Lluís Vilanova" <vilanova@ac.upc.edu>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: "Wanpeng Li" <liwp@linux.vnet.ibm.com>,
"Stefan Hajnoczi" <stefanha@gmail.com>,
qemu-devel <qemu-devel@nongnu.org>,
"Anthony Liguori" <anthony@codemonkey.ws>,
"Andreas Färber" <afaerber@suse.de>,
"Gavin Shan" <shangw@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH] RFC: options parse in vl.c should be moduled
Date: Fri, 30 Mar 2012 19:52:46 +0200 [thread overview]
Message-ID: <87wr62m0wh.fsf@ginnungagap.bsc.es> (raw)
In-Reply-To: <4F75DFF8.4030403@us.ibm.com> (Anthony Liguori's message of "Fri, 30 Mar 2012 11:31:52 -0500")
Anthony Liguori writes:
>> My plan is to have a -query-capabilities so we can change the help text, then
>> use GOptionContext.
>>
>> It would take a small function that goes through and promotes any option in the
>> format '-foo' to '--foo'. But that's not too hard.
>>
>> Then we can completely rip out the option parsing, qemu-options.hx, and all of
>> that other junk.
> glib's option parsing support has some really nice features like translation
> support, grouping, and inline help for option definition.
> The grouping is a really nice touch. It will let us have a target specific
> group, device groups, etc.
This sounds really nice and much more "uncrufty".
What I'd like to see is some "type_init"-like black magic so that code can
easily register GOptionEntry structures without having to resort to modifying a
central file (otherwise I think the story will repeat itself again).
For this to work, besides defining the GOptionEntry itself, the programmer
should also establish:
* The option group (for cmdline help grouping). This is already supported by
GOptionGroup, and everybody should register against a set of pre-defined
groups.
* The parsing priority (so that it's easy to establish a partial order on the
parsing of options). This also requires a set of pre-defined priorities to
register against.
What I'm not sure is whether both can be merged into a single one. That is, that
options in the same group don't care about the order in which their parsing
callbacks are called (as long as you know the order between groups).
Lluis
--
"And it's much the same thing with knowledge, for whenever you learn
something new, the whole world becomes that much richer."
-- The Princess of Pure Reason, as told by Norton Juster in The Phantom
Tollbooth
prev parent reply other threads:[~2012-03-30 17:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-30 12:36 [Qemu-devel] [PATCH] RFC: options parse in vl.c should be moduled Wanpeng Li
2012-03-30 12:53 ` Daniel P. Berrange
2012-03-30 13:25 ` Wanpeng Li
[not found] ` <4f75b5f3.2235b60a.302d.ffffa586SMTPIN_ADDED@mx.google.com>
2012-03-30 15:55 ` Michael Roth
2012-03-30 13:10 ` Anthony Liguori
2012-03-30 15:59 ` Lluís Vilanova
2012-03-30 16:09 ` Anthony Liguori
2012-03-30 16:31 ` Anthony Liguori
2012-03-30 17:52 ` Lluís Vilanova [this message]
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=87wr62m0wh.fsf@ginnungagap.bsc.es \
--to=vilanova@ac.upc.edu \
--cc=afaerber@suse.de \
--cc=aliguori@us.ibm.com \
--cc=anthony@codemonkey.ws \
--cc=liwp@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=shangw@linux.vnet.ibm.com \
--cc=stefanha@gmail.com \
/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).