From: Andrew Cagney <cagney@redhat.com>
To: Phil Muldoon <pmuldoon@redhat.com>
Cc: Frysk Hackers <frysk@sourceware.org>
Subject: Re: Patch: Add Option Groups
Date: Thu, 20 Mar 2008 11:52:00 -0000 [thread overview]
Message-ID: <47E24FB8.7090507@redhat.com> (raw)
In-Reply-To: <47E0C4DC.2080609@redhat.com>
Phil Muldoon wrote:
> Andrew Cagney wrote:
>> Phil,
>>
>> public CommandlineParser(String name, String version) {
>>
>> I'd either:
>>
>> create the utility specific group, and then the standard frysk
>> option group and all the standard frysk options here; and then have
>> "add" add to the utility specific group - since group order comes
>> first things will be as expected
>
> Don't know the name of the group so far ahead of time. The Option
> group name has to be created at group creation time. And I really want
> the freedom given to the user to create as many groups as they like,
> so complex utilities like ftrace can have many groups.
Good point; there's also a getopt "feature" we need to avoid, things
need to be created using the sequence:
- create group
- add group members
- add group to parser
otherwise, while they show up in the help message, they don't work.
Quick read of Parser.add(OptionGroup) shows why.
>
>>
>> or
>>
>> add an abstract method to get the options to CommandLineParser and
>> have the extensions implement that - it can then be called before the
>> standard frysk options group is created
>>
>
> Still going to have to have the build custom options, then build
> standard options call somewhere in CommandlineParser unless we tell
> the user to explicitly to include the default options themselves.
> Also means a relationship change. Right now CommandlineParser is
> called, not extended.
>
Phil and I discussed this in yesterday's meeting and came up with just
adding a list of OptionGroup[]s to the CommandLine constructor, but more
change but ends up being much simpler.
Andrew
> Nevertheless something like:
>
> public abstract buildCustomOptions
>
> then in subclass
>
> buildCustomOptions {
> OptionGroup foo = new OptionGroup("Foo Group");
> parser.add(foo).
> foo.add(new Option(...))
>
> OptionGroup foo2= new OptionGrouo("Extended Foo Group");
> parser.add(foo2).
> foo2.add(new Option(...))
>
> ...
> ...
> ...
> super.buildDefaultOptions() ;
> }
>
> Something like this?
next prev parent reply other threads:[~2008-03-20 11:52 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-18 17:41 Phil Muldoon
2008-03-18 18:28 ` Tom Tromey
2008-03-19 7:51 ` Phil Muldoon
2008-03-19 13:23 ` Tom Tromey
2008-03-18 20:11 ` Andrew Cagney
2008-03-19 7:46 ` Phil Muldoon
2008-03-20 11:52 ` Andrew Cagney [this message]
2008-03-20 14:23 ` Tom Tromey
2008-03-20 16:09 ` Andrew Cagney
2008-03-20 18:06 ` Tom Tromey
2008-04-01 21:36 ` Andrew Cagney
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=47E24FB8.7090507@redhat.com \
--to=cagney@redhat.com \
--cc=frysk@sourceware.org \
--cc=pmuldoon@redhat.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 read-only IMAP folder(s) and NNTP newsgroup(s).