Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 34006 invoked from network); 10 Jun 2003 23:24:42 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 10 Jun 2003 23:24:42 -0000 Received: (qmail 24819 invoked by uid 97); 10 Jun 2003 23:27:05 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@nagoya.betaversion.org Received: (qmail 24812 invoked from network); 10 Jun 2003 23:27:04 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by nagoya.betaversion.org with SMTP; 10 Jun 2003 23:27:04 -0000 Received: (qmail 33747 invoked by uid 500); 10 Jun 2003 23:24:38 -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 33729 invoked from network); 10 Jun 2003 23:24:38 -0000 Received: from a17-250-248-87.apple.com (HELO smtpout.mac.com) (17.250.248.87) by daedalus.apache.org with SMTP; 10 Jun 2003 23:24:38 -0000 Received: from mac.com (smtpin08-en2 [10.13.10.153]) by smtpout.mac.com (Xserve/MantshX 2.0) with ESMTP id h5ANOkmc022462 for ; Tue, 10 Jun 2003 16:24:46 -0700 (PDT) Received: from mac.com (k100-49.bas1.dbn.dublin.eircom.net [159.134.100.49]) (authenticated bits=0) by mac.com (Xserve/8.12.9/MantshX 2.0) with ESMTP id h5ANOgaa012555 for ; Tue, 10 Jun 2003 16:24:44 -0700 (PDT) Date: Wed, 11 Jun 2003 00:27:43 +0100 Subject: Re: [CLI][PATCH] Min and Max size for arguments Content-Type: text/plain; delsp=yes; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v552) From: John Keyes To: Jakarta Commons Developers List Content-Transfer-Encoding: 7bit In-Reply-To: <028701c32f77$6791d4d0$2ff1f682@har.mrc.ac.uk> Message-Id: <22CB8F4F-9B9B-11D7-AA1B-00039379521C@mac.com> X-Mailer: Apple Mail (2.552) 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 Tuesday, Jun 10, 2003, at 18:40 Europe/Dublin, Rob Oxspring wrote: > Attached is a patch that allows arguments to have specified a minimum > and maximum number of values rather than just the previous > "size". An example of use might be where you are selecting a number > of files for an operation but want to ensure that at least one > value was specified: > > options.add( > ArgumentBuilder > .createBuilder() > .withLongName("search-location") > .withMinimumSize(1) > .withMaximumSize(100) > .withValueName("directory") > .create()); > > ArgumentBuilder.withSize(int) has been retained and sets both min and > max to the same. (This might be a bad thing if both size and > min/max are specified though). I think that we can remove withSize, if someone calls withMaximumSize then the minSize should be set to 1 automatically. It should be explicit for someone to specify a minimum size of 0 i.e. an optional value. > ArgumentBuilder.withOptionalValues(boolean) has been removed since its > a function of the min and max values. > > Argument.hasOptionalValues() has been retained and returns min 0 then that means a value is required. > Argument.getSize() has been removed and getMaximumSize() or > getMinimumSize() should be used instead. > > Thoughts welcome. If you want me to commit it myself then I'll need > access to jakarta-commons first. Thats brilliant. Thanks Rob. I'll look through the patch and make the changes I specified here. I'll get it commited tomorrow at some stage. I'll also stick the license on the testcase, no probs. Thanks again, -John K > > Rob > > Oh - and the extra testcase needs the apache licence attached, whoops. > -------------------------------------------- > ------------------------- > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org > For additional commands, e-mail: commons-dev-help@jakarta.apache.org - - - - - - - - - - - - - - - - - - - - - - - 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