From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19323 invoked by alias); 20 Mar 2008 11:52:04 -0000 Received: (qmail 19311 invoked by uid 22791); 20 Mar 2008 11:52:03 -0000 X-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 20 Mar 2008 11:51:46 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id m2KBpisJ027988 for ; Thu, 20 Mar 2008 07:51:44 -0400 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [10.11.255.20]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m2KBphGf013247; Thu, 20 Mar 2008 07:51:43 -0400 Received: from localhost.localdomain (sebastian-int.corp.redhat.com [172.16.52.221]) by pobox.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m2KBphKS009503; Thu, 20 Mar 2008 07:51:43 -0400 Message-ID: <47E24FB8.7090507@redhat.com> Date: Thu, 20 Mar 2008 11:52:00 -0000 From: Andrew Cagney User-Agent: Thunderbird 2.0.0.12 (X11/20080226) MIME-Version: 1.0 To: Phil Muldoon CC: Frysk Hackers Subject: Re: Patch: Add Option Groups References: <47DFFE9D.80906@redhat.com> <47E021DF.40407@redhat.com> <47E0C4DC.2080609@redhat.com> In-Reply-To: <47E0C4DC.2080609@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 X-IsSubscribed: yes Mailing-List: contact frysk-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: frysk-owner@sourceware.org X-SW-Source: 2008-q1/txt/msg00175.txt.bz2 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?