You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Andrew Shirley <ak...@decisionsoft.co.uk> on 2006/04/13 16:19:24 UTC

[cli][patch] parsing option arguments which have a default

Hi,

I have found a bug in the following scenario:
You have an option which can take a single argument which in turn has a default
value. You supply a value on the command line which is intended to override
this default however as the CommandLine already has a value for this Option,
this second value is not allowed and the command line cannot be parsed.

I have created a patch which adds a method to WritableCommandLine and its Impl
which allows you to retrieve the undefaulted values for an Option. I have then
changed ArgumentImpl to use this method to determine the argument count

Please find attached a patch and a testsuite.

cheers
Andrew Shirley

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


Re: [cli][patch] parsing option arguments which have a default

Posted by Andrew Shirley <ak...@decisionsoft.co.uk>.
> Please find attached a patch and a testsuite.

:-)

Re: [cli][patch] parsing option arguments which have a default

Posted by Andrew Shirley <ak...@decisionsoft.co.uk>.
On Thu, Apr 13, 2006 at 03:19:24PM +0100, Andrew Shirley wrote:
> Hi,
> 
> I have found a bug in the following scenario:
> You have an option which can take a single argument which in turn has a default
> value. You supply a value on the command line which is intended to override
> this default however as the CommandLine already has a value for this Option,
> this second value is not allowed and the command line cannot be parsed.
> 
> I have created a patch which adds a method to WritableCommandLine and its Impl
> which allows you to retrieve the undefaulted values for an Option. I have then
> changed ArgumentImpl to use this method to determine the argument count
> 
> Please find attached a patch and a testsuite.

This has now been added to bugzilla.

http://issues.apache.org/bugzilla/show_bug.cgi?id=39335

cheers
Andrew Shirley

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