Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 80704 invoked from network); 6 Feb 2003 12:29:47 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 6 Feb 2003 12:29:47 -0000 Received: (qmail 24947 invoked by uid 97); 6 Feb 2003 12:31:14 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@nagoya.betaversion.org Received: (qmail 24940 invoked from network); 6 Feb 2003 12:31:13 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by nagoya.betaversion.org with SMTP; 6 Feb 2003 12:31:13 -0000 Received: (qmail 80518 invoked by uid 500); 6 Feb 2003 12:29:45 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 80502 invoked from network); 6 Feb 2003 12:29:45 -0000 Received: from smtpout.mac.com (17.250.248.87) by daedalus.apache.org with SMTP; 6 Feb 2003 12:29:45 -0000 Received: from asmtp02.mac.com (asmtp02-qfe3 [10.13.10.66]) by smtpout.mac.com (Xserve/MantshX 2.0) with ESMTP id h16CTjg7003528 for ; Thu, 6 Feb 2003 04:29:45 -0800 (PST) Received: from oasis.capeclear.ie ([193.120.208.97]) by asmtp02.mac.com (Netscape Messaging Server 4.15) with ESMTP id H9W01K00.K5V; Thu, 6 Feb 2003 04:29:44 -0800 Subject: RE: [CLI] new design possibly? From: John Keyes To: tima@intalio.com Cc: Jakarta Commons Developers List In-Reply-To: References: Content-Type: text/plain Organization: Message-Id: <1044534583.995.13.camel@oasis.capeclear.ie> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.1 Date: 06 Feb 2003 12:29:43 +0000 Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N On Thu, 2003-02-06 at 10:55, Tim Anderson wrote: > 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: > -execute -db [-version ] -schema [-drop] > -print -db [-version ] [-drop] > -list > -types > > db-props: > -driver -url [-user ] [-password ] > > In the above, -execute, -print, -list and -types are mutually exclusive, > and represents a set of arguments which are applicable to both > -execute and -types. > I have almost finished work on child options (needs more testing) but this will support the behaviour you describe here (I think). So it would be something like: Option driver = new Option(); Option url = new Option(); Set opts = new HashSet(); opts.add(driver); opts.add(url); Option types = new Option(); types.addChildOptions(opts); Option execute = new Option(); execute.addChildOptions(opts); ..... > 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? I think the framework is all there for it at the moment, just some small tweaks are needed. Cheers, -John K > > 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 -- John Keyes --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org