This is the mail archive of the frysk@sourceware.org mailing list for the frysk project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch: Add Option Groups


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?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]