commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tim Anderson" <t...@intalio.com>
Subject RE: [CLI] new design possibly?
Date Thu, 06 Feb 2003 10:55:09 GMT
Not a critique on your design, but an RFE ;)

One useful addition to CLI would be to be able to specify
mutually exclusive sets of arguments, which contain common
options. Eg:

usage: org.apache.commons.sql.util.DDL <commands>
commands:
  -execute -db <db> [-version <version>] <db-props> -schema <path>
[-drop]
  -print -db <provider> [-version <version>] [-drop]
  -list
  -types <db-props>

db-props:
  -driver <driver> -url <url> [-user <user>] [-password <password>]

In the above, -execute, -print, -list and -types are mutually exclusive,
and <db-props> represents a set of arguments which are applicable to both
-execute and -types.

It would be nice to be able to do something like:

OptionSet dbprops = new OptionSet("db-props");
dbprops.addOption("driver", true, ....);
dbprops.addOption("url", true, ....);
...

OptionSet execute = new OptionSet("execute", "executes DDL for a schema");
execute.addOption("db", true, ....);
execute.addOptionSet(dbprops);
...

OptionSet types = new OptionSet("types", "generate type info");
types.addOptionSet(dbprops);

OptionGroup group = new OptionGroup();
group.addOptionSet(execute);
...
group.addOptionSet(types);


The advantages of this are that:
. CLI can do more of the validation
. HelpFormatter can be enhanced to format wierder command line 
  syntaxes (such as the above), rather than doing it manually in code.


Thoughts?

Thanks,

Tim


> -----Original Message-----
> From: John Keyes [mailto:jbjk@mac.com]
> Sent: Thursday, February 06, 2003 10:59 AM
> To: commons-dev
> Subject: [CLI] new design possibly?
> 
> 
> I have grown disgruntled with CLIs current design so I have done
> some thinking on the matter (BTW, I know I should have done
> this before a 1.0 release).  Before I finish working on it
> I thought I'd seek comments from you guys.  Check out the
> class diagram at http://www.integralsource.com/cli/datatype.gif
> and let me hear your comments.
> 
> Thanks,
> -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
> 


---------------------------------------------------------------------
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