You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "MADDOCKS,PETE (HP-Loveland,ex1)" <pe...@hp.com> on 2002/09/09 20:20:42 UTC

[PATCH] [CLI] Optional Argument bug fixes

I've attached the patch files for the fixes described below.  Please let me
know if you have questions.

Thanks,
Peter Maddocks 

-----Original Message-----
From: John Keyes [mailto:jbjk@mac.com] 
Sent: Saturday, September 07, 2002 10:44 AM
To: Jakarta Commons Developers List
Subject: Re: [CLI] 2 requests

If you just want to submit the diffs of the files I can patch and
commit the changes.

Thanks for the help,
-John K

On Friday, Sep 6, 2002, at 22:47 Etc/GMT, MADDOCKS,PETE 
(HP-Loveland,ex1) wrote:

> Hi John,
>
> Thanks for the information.  I grabbed the latest version of code and 
> was
> able to use both features that you described.  I also found a handful 
> of
> bugs in the process which I have fixed in my copy of the code.  What 
> is the
> best way to proceed in submitting these changes back to Apache?  I'll 
> read
> about becoming a contributing member...
>
> The bugs that I found include:
> 1.  OptionBuilder's reset() method was not resetting "optionalArg" and
> "valueSep".
> 2.  In the Options class getOptions() method - options that were "long 
> only"
> were not being returned.
> 3.  HelpFormatter's render() method did not handle "long only" options
> niceley in formatting.
> 4.  The StringBufferComparator inner class in HelpFormatter should 
> strip the
> option prefix before comparing strings.  (This comes into play with 
> "long
> only" options.)
>
> On Monday I'll try to submit these changes back.
>
>
> Thanks,
> Peter Maddocks
> HP NSS NAS Software Design Engineer
> peter_maddocks@hp.com
>
>
> -----Original Message-----
> From: John Keyes [mailto:jbjk@mac.com]
> Sent: Thursday, September 05, 2002 2:41 AM
> To: Jakarta Commons Developers List
> Subject: Re: [CLI] 2 requests
>
> Hi Pete,
>
> On Thu, 2002-09-05 at 00:14, MADDOCKS,PETE (HP-Loveland,ex1) wrote:
>> Hi,
>>
>> I notice that over the last month or so a lot of rework has been done 
>> to
> the
>> CLI package.  I have 2 changes that I need from the 1.3 release and I
> can't
>> tell from the documentation if these have been addressed:
>>
>> 1. Support Long only options.  The Option constructor now takes a 
>> String
>> rather than a char for the short option specifier.  Does this mean 
>> that if
> I
>> want a long-only option, I can just pass a long String into the short
> option
>> paramater?
>>
>> Example usage:
>> 	vg  [volgroupname] [ options ]
>>
>> 	ARGUMENTS
>> 	volgroupname
>>
>> 	OPTIONS
>> 	--rename newvolgroupname
>>
>>
>   Option rename = OptionBuilder.withLongOpt( "rename" )
>                            .create();
>
> This is logged in bugzilla:
>   http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11457
>
>> 2. I need optional arguments on an option.  The Option Constructor 
>> takes a
>> boolean for whether arguments are required and a boolean for multiple
>> arguments.  What happens if I pass "false" for requires args and 
>> "true"
> for
>> multiple args?
>>
>>
>> Example usage:
>> 	vg  [volgroupname] [ options ]
>>
>> 	ARGUMENTS
>> 	volgroupname
>>
>> 	OPTIONS
>> 	-p,--package [newpackagename]
>> 	  		if a [newpackagename] argument is provided then the
>> VolGroup's package name 			is set to the new value.
>> Otherwise, the current value of the package is
> displayed.
> This is logged in bugzilla:
>   http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11456
>
> Option pkg = OptionBuilder.hasOptionalArg()
>                           .withLongOpt( "package" )
>                           .create( 'p' ) );
>
> Give these a whizz and let me know how you get on.  Check
> out the OptionBuilder API for all this kind of stuff.
>
> Cheers,
> -John K
>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
> --
> To unsubscribe, e-mail:   
> <ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


Re: [PATCH] [CLI] Optional Argument bug fixes

Posted by John Keyes <jb...@mac.com>.
That patch is applied now.  I'll try to add some unit tests to
cover the new stuff.  The code is now complete for a 1.0
release.  I'll add a couple of more tests and we're flying.
Thanks again for the patch Pete, I changed the Options
fix a bit by using an ArrayList instead of a Vector, as the
add methods are not synchronized, apart from that its the
same.  I'll add you to the contributors list too ;)

Cheers,
-John K

On Monday, Sep 9, 2002, at 20:24 Etc/GMT, John Keyes wrote:

> Cheers Pete,
>
> I'll report back when I have the patch applied.
>
> -John K
>
> On Monday, Sep 9, 2002, at 18:20 Etc/GMT, MADDOCKS,PETE  
> (HP-Loveland,ex1) wrote:
>
>> I've attached the patch files for the fixes described below.  Please  
>> let me
>> know if you have questions.
>>
>> Thanks,
>> Peter Maddocks
>>
>> -----Original Message-----
>> From: John Keyes [mailto:jbjk@mac.com]
>> Sent: Saturday, September 07, 2002 10:44 AM
>> To: Jakarta Commons Developers List
>> Subject: Re: [CLI] 2 requests
>>
>> If you just want to submit the diffs of the files I can patch and
>> commit the changes.
>>
>> Thanks for the help,
>> -John K
>>
>> On Friday, Sep 6, 2002, at 22:47 Etc/GMT, MADDOCKS,PETE
>> (HP-Loveland,ex1) wrote:
>>
>>> Hi John,
>>>
>>> Thanks for the information.  I grabbed the latest version of code and
>>> was
>>> able to use both features that you described.  I also found a handful
>>> of
>>> bugs in the process which I have fixed in my copy of the code.  What
>>> is the
>>> best way to proceed in submitting these changes back to Apache?  I'll
>>> read
>>> about becoming a contributing member...
>>>
>>> The bugs that I found include:
>>> 1.  OptionBuilder's reset() method was not resetting "optionalArg"  
>>> and
>>> "valueSep".
>>> 2.  In the Options class getOptions() method - options that were  
>>> "long
>>> only"
>>> were not being returned.
>>> 3.  HelpFormatter's render() method did not handle "long only"  
>>> options
>>> niceley in formatting.
>>> 4.  The StringBufferComparator inner class in HelpFormatter should
>>> strip the
>>> option prefix before comparing strings.  (This comes into play with
>>> "long
>>> only" options.)
>>>
>>> On Monday I'll try to submit these changes back.
>>>
>>>
>>> Thanks,
>>> Peter Maddocks
>>> HP NSS NAS Software Design Engineer
>>> peter_maddocks@hp.com
>>>
>>>
>>> -----Original Message-----
>>> From: John Keyes [mailto:jbjk@mac.com]
>>> Sent: Thursday, September 05, 2002 2:41 AM
>>> To: Jakarta Commons Developers List
>>> Subject: Re: [CLI] 2 requests
>>>
>>> Hi Pete,
>>>
>>> On Thu, 2002-09-05 at 00:14, MADDOCKS,PETE (HP-Loveland,ex1) wrote:
>>>> Hi,
>>>>
>>>> I notice that over the last month or so a lot of rework has been  
>>>> done
>>>> to
>>> the
>>>> CLI package.  I have 2 changes that I need from the 1.3 release and  
>>>> I
>>> can't
>>>> tell from the documentation if these have been addressed:
>>>>
>>>> 1. Support Long only options.  The Option constructor now takes a
>>>> String
>>>> rather than a char for the short option specifier.  Does this mean
>>>> that if
>>> I
>>>> want a long-only option, I can just pass a long String into the  
>>>> short
>>> option
>>>> paramater?
>>>>
>>>> Example usage:
>>>> 	vg  [volgroupname] [ options ]
>>>>
>>>> 	ARGUMENTS
>>>> 	volgroupname
>>>>
>>>> 	OPTIONS
>>>> 	--rename newvolgroupname
>>>>
>>>>
>>>   Option rename = OptionBuilder.withLongOpt( "rename" )
>>>                            .create();
>>>
>>> This is logged in bugzilla:
>>>   http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11457
>>>
>>>> 2. I need optional arguments on an option.  The Option Constructor
>>>> takes a
>>>> boolean for whether arguments are required and a boolean for  
>>>> multiple
>>>> arguments.  What happens if I pass "false" for requires args and
>>>> "true"
>>> for
>>>> multiple args?
>>>>
>>>>
>>>> Example usage:
>>>> 	vg  [volgroupname] [ options ]
>>>>
>>>> 	ARGUMENTS
>>>> 	volgroupname
>>>>
>>>> 	OPTIONS
>>>> 	-p,--package [newpackagename]
>>>> 	  		if a [newpackagename] argument is provided then the
>>>> VolGroup's package name 			is set to the new value.
>>>> Otherwise, the current value of the package is
>>> displayed.
>>> This is logged in bugzilla:
>>>   http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11456
>>>
>>> Option pkg = OptionBuilder.hasOptionalArg()
>>>                           .withLongOpt( "package" )
>>>                           .create( 'p' ) );
>>>
>>> Give these a whizz and let me know how you get on.  Check
>>> out the OptionBuilder API for all this kind of stuff.
>>>
>>> Cheers,
>>> -John K
>>>
>>>
>>>
>>> --
>>> To unsubscribe, e-mail:
>>> <ma...@jakarta.apache.org>
>>> For additional commands, e-mail:
>>> <ma...@jakarta.apache.org>
>>>
>>> --
>>> To unsubscribe, e-mail:
>>> <ma...@jakarta.apache.org>
>>> For additional commands, e-mail:
>>> <ma...@jakarta.apache.org>
>>>
>>
>>
>> --
>> To unsubscribe, e-mail:
>> <ma...@jakarta.apache.org>
>> For additional commands, e-mail:
>> <ma...@jakarta.apache.org>
>>
>> <HelpFormatter.java.patch><OptionBuilder.java.patch><Options.java.patc 
>> h>--
>> To unsubscribe, e-mail:    
>> <ma...@jakarta.apache.org>
>> For additional commands, e-mail:  
>> <ma...@jakarta.apache.org>
>
>
> --
> To unsubscribe, e-mail:    
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:  
> <ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [PATCH] [CLI] Optional Argument bug fixes

Posted by John Keyes <jb...@mac.com>.
Cheers Pete,

I'll report back when I have the patch applied.

-John K

On Monday, Sep 9, 2002, at 18:20 Etc/GMT, MADDOCKS,PETE  
(HP-Loveland,ex1) wrote:

> I've attached the patch files for the fixes described below.  Please  
> let me
> know if you have questions.
>
> Thanks,
> Peter Maddocks
>
> -----Original Message-----
> From: John Keyes [mailto:jbjk@mac.com]
> Sent: Saturday, September 07, 2002 10:44 AM
> To: Jakarta Commons Developers List
> Subject: Re: [CLI] 2 requests
>
> If you just want to submit the diffs of the files I can patch and
> commit the changes.
>
> Thanks for the help,
> -John K
>
> On Friday, Sep 6, 2002, at 22:47 Etc/GMT, MADDOCKS,PETE
> (HP-Loveland,ex1) wrote:
>
>> Hi John,
>>
>> Thanks for the information.  I grabbed the latest version of code and
>> was
>> able to use both features that you described.  I also found a handful
>> of
>> bugs in the process which I have fixed in my copy of the code.  What
>> is the
>> best way to proceed in submitting these changes back to Apache?  I'll
>> read
>> about becoming a contributing member...
>>
>> The bugs that I found include:
>> 1.  OptionBuilder's reset() method was not resetting "optionalArg" and
>> "valueSep".
>> 2.  In the Options class getOptions() method - options that were "long
>> only"
>> were not being returned.
>> 3.  HelpFormatter's render() method did not handle "long only" options
>> niceley in formatting.
>> 4.  The StringBufferComparator inner class in HelpFormatter should
>> strip the
>> option prefix before comparing strings.  (This comes into play with
>> "long
>> only" options.)
>>
>> On Monday I'll try to submit these changes back.
>>
>>
>> Thanks,
>> Peter Maddocks
>> HP NSS NAS Software Design Engineer
>> peter_maddocks@hp.com
>>
>>
>> -----Original Message-----
>> From: John Keyes [mailto:jbjk@mac.com]
>> Sent: Thursday, September 05, 2002 2:41 AM
>> To: Jakarta Commons Developers List
>> Subject: Re: [CLI] 2 requests
>>
>> Hi Pete,
>>
>> On Thu, 2002-09-05 at 00:14, MADDOCKS,PETE (HP-Loveland,ex1) wrote:
>>> Hi,
>>>
>>> I notice that over the last month or so a lot of rework has been done
>>> to
>> the
>>> CLI package.  I have 2 changes that I need from the 1.3 release and I
>> can't
>>> tell from the documentation if these have been addressed:
>>>
>>> 1. Support Long only options.  The Option constructor now takes a
>>> String
>>> rather than a char for the short option specifier.  Does this mean
>>> that if
>> I
>>> want a long-only option, I can just pass a long String into the short
>> option
>>> paramater?
>>>
>>> Example usage:
>>> 	vg  [volgroupname] [ options ]
>>>
>>> 	ARGUMENTS
>>> 	volgroupname
>>>
>>> 	OPTIONS
>>> 	--rename newvolgroupname
>>>
>>>
>>   Option rename = OptionBuilder.withLongOpt( "rename" )
>>                            .create();
>>
>> This is logged in bugzilla:
>>   http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11457
>>
>>> 2. I need optional arguments on an option.  The Option Constructor
>>> takes a
>>> boolean for whether arguments are required and a boolean for multiple
>>> arguments.  What happens if I pass "false" for requires args and
>>> "true"
>> for
>>> multiple args?
>>>
>>>
>>> Example usage:
>>> 	vg  [volgroupname] [ options ]
>>>
>>> 	ARGUMENTS
>>> 	volgroupname
>>>
>>> 	OPTIONS
>>> 	-p,--package [newpackagename]
>>> 	  		if a [newpackagename] argument is provided then the
>>> VolGroup's package name 			is set to the new value.
>>> Otherwise, the current value of the package is
>> displayed.
>> This is logged in bugzilla:
>>   http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11456
>>
>> Option pkg = OptionBuilder.hasOptionalArg()
>>                           .withLongOpt( "package" )
>>                           .create( 'p' ) );
>>
>> Give these a whizz and let me know how you get on.  Check
>> out the OptionBuilder API for all this kind of stuff.
>>
>> Cheers,
>> -John K
>>
>>
>>
>> --
>> To unsubscribe, e-mail:
>> <ma...@jakarta.apache.org>
>> For additional commands, e-mail:
>> <ma...@jakarta.apache.org>
>>
>> --
>> To unsubscribe, e-mail:
>> <ma...@jakarta.apache.org>
>> For additional commands, e-mail:
>> <ma...@jakarta.apache.org>
>>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
> <HelpFormatter.java.patch><OptionBuilder.java.patch><Options.java.patch 
> >--
> To unsubscribe, e-mail:    
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:  
> <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>