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<max
This should just return min == 0? If min is > 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.
<ArgumentMinAndMaxSize.zip>-------------------------------------------- -------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
- - - - - - - - - - - - - - - - - - - - - - -
Jakarta Commons CLI
http://jakarta.apache.org/commons/cli


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to