commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Keyes <j...@mac.com>
Subject [CLI] child Options
Date Sat, 31 May 2003 15:41:00 GMT
The current version on the branch has support for child Options:
   addChild(Option)
   addChildren(Set)

I think that this is too restrictive and the correct support should be:
   addOptions(Options)

This will allow the following style command line:

app -option -x|-y

The definition for this is:

   // build child options
   Option x = builder.withName("x").create();
   Option y = builder.withName("y").create();
   ExclusiveGroup axis = new ExclusiveGroup();
   axis.add(x);
   axis.add(y);
   Options child = new Options();
   child.add(axis);

   // build option
   Option option = builder.withName("option").create();
   option.setOptions(child);

   // build application options
   Options options = new Options();
   options.add(option);

This means that if "-option" is found in the command line arguments,
parse the remaining arguments using the Options specified for 'option'.
In this case, the only valid remaining arguments are "-x" or "-y", but
not both.

If I don't hear any reasons why people think this approach is incorrect
(or any other significant comments) I will proceed to implement it.

-John K
- - - - - - - - - - - - - - - - - - - - - - -
Jakarta Commons CLI
http://jakarta.apache.org/commons/cli


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message