You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bob mcwhirter <bo...@werken.com> on 2002/06/18 01:10:51 UTC

Re: [CLI] -D a special case?

> I am wondering if the -D<name>=<value> case should be
> treated as a special case.  This would require some
> additional work for both the POSIX and GNU parsers. I
> think that as the -D is associated with setting system
> properties it should be treated as a special case.

I have no problem using CLI now to deal with my -Dname
or -Dname=value case.  I really think that this is something
that's best left up to the application.

> I am +1 for only treating -D as a special case as it is
> a specific well defined special case.  If someone can
> provide a good argument for "-[a-z]+", I will follow
> that route.

I guess I'm confused.  Will -D -always- set a java System
property?  If so, I think that's overstepping our bounds.

	-bob



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


Re: [CLI] -D a special case?

Posted by bob mcwhirter <bo...@werken.com>.
> I'll just code it and then it can be reviewed later.

+1

	-bob
	(able to misunderstand just about anything, so
	don't worry... )


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


Re: [CLI] -D a special case?

Posted by John Keyes <jb...@mac.com>.
> Me, personally, if I have a program that takes a
> 
> 	-Dfoo=bar
> 
> I still want getOptionValue( 'D' ) to return the single string
> "foo=bar" for me to munge how I see fit.
I think we were just getting our wires crossed ;)  What I meant
is that with the GnuParser if I a program takes -Dfoo=bar on the
command line, then the actual option is '-Dfoo=bar' and its value
is not set i.e. the string is not burst as string options are 
allowed.  So to handle this type of argument using the GnuParser
requires some work (and documentation).  The PosixParser remains
untouched (and is also the default parser).  So when the work
is finished on GnuParser, the call getOptionValue( "d" ) will
return "foo=bar" for it also.

I think the more I type, the more I confuse people (its a gift
of mine).  I'll just code it and then it can be reviewed
(or removed ;) later.

-John K



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


Re: [CLI] -D a special case?

Posted by bob mcwhirter <bo...@werken.com>.
> When you say 'I think I'd personally turn that option off...'
> do you mean that you wouldn't provide a different parser
> implementation, or that you wouldn't provide a special case
> for handling the "-<char><name>=<value>".  I'm a bit confused
> now.

Me, personally, if I have a program that takes a

	-Dfoo=bar

I still want getOptionValue( 'D' ) to return the single string
"foo=bar" for me to munge how I see fit.

> > If it's something I could turn off (or is off by default), then
> > sure, go for it. ;)
> I can definitely make it optional and I agree it probably
> should be.

Cool.

	-bob


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


Re: [CLI] -D a special case?

Posted by John Keyes <jb...@mac.com>.
>> Thats because you are using the POSIX parser.  If you use
>> the GNU parser the "-Dname=value" is treated as the option.
>> I could check if the second character is an option and the
>> "=" character is also present in the option.  If
>> so then set its value to the rest of the string.  The value
>> would then be name=value.  What do you think of this?
>
> Yah, I dunno.  I think I'd personally turn that option off and
> do it my way.  Sometimes, there won't be an equals sign, if
> someone is just attempting to set something to true;
>
> 	-Doptimize
I suppose a better way to check would be, if the second
character is an option, and the full string is not an option,
then treat what follows the second character as the value.
Let the user decide what the value of the option represents
and let them process it accordingly.

When you say 'I think I'd personally turn that option off...'
do you mean that you wouldn't provide a different parser
implementation, or that you wouldn't provide a special case
for handling the "-<char><name>=<value>".  I'm a bit confused
now.

> If it's something I could turn off (or is off by default), then
> sure, go for it. ;)
I can definitely make it optional and I agree it probably
should be.

-John K

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


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


Re: [CLI] -D a special case?

Posted by bob mcwhirter <bo...@werken.com>.
> > I have no problem using CLI now to deal with my -Dname
> > or -Dname=value case.  I really think that this is something
> > that's best left up to the application.
> 
> Thats because you are using the POSIX parser.  If you use
> the GNU parser the "-Dname=value" is treated as the option.
> I could check if the second character is an option and the
> "=" character is also present in the option.  If
> so then set its value to the rest of the string.  The value
> would then be name=value.  What do you think of this?

Yah, I dunno.  I think I'd personally turn that option off and
do it my way.  Sometimes, there won't be an equals sign, if
someone is just attempting to set something to true;

	-Doptimize

If it's something I could turn off (or is off by default), then
sure, go for it. ;)

	-bob


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


Re: [CLI] -D a special case?

Posted by John Keyes <jb...@mac.com>.
>> I am wondering if the -D<name>=<value> case should be
>> treated as a special case.  This would require some
>> additional work for both the POSIX and GNU parsers. I
>> think that as the -D is associated with setting system
>> properties it should be treated as a special case.
>
> I have no problem using CLI now to deal with my -Dname
> or -Dname=value case.  I really think that this is something
> that's best left up to the application.

Thats because you are using the POSIX parser.  If you use
the GNU parser the "-Dname=value" is treated as the option.
I could check if the second character is an option and the
"=" character is also present in the option.  If
so then set its value to the rest of the string.  The value
would then be name=value.  What do you think of this?

>> I am +1 for only treating -D as a special case as it is
>> a specific well defined special case.  If someone can
>> provide a good argument for "-[a-z]+", I will follow
>> that route.
>
> I guess I'm confused.  Will -D -always- set a java System
> property?  If so, I think that's overstepping our bounds.
Thats fair enough.  I was just thinking that maybe this could
be turned on or off.  It is better to keep things as
straight forward as possible though.

-John K
>
> 	-bob
>
>
>
> --
> To unsubscribe, e-mail:   <mailto:commons-dev-
> unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:commons-dev-
> help@jakarta.apache.org>
>


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


Re: [CLI] -D a special case?

Posted by John Keyes <jb...@mac.com>.
I have commited the first impl of the so called
GnuParser (I'll take odds that this name will come
back to bite me in the ass ;)  Anyhoo, the unit
test 'ApplicationTest' contains one test at the
moment for 'ant'.  I will add more test cases
here soon.  So if you want to have a look at the
impl Bob you can let me know if its clear or not.

-John K

On Monday, June 17, 2002, at 11:10 , bob mcwhirter wrote:

>> I am wondering if the -D<name>=<value> case should be
>> treated as a special case.  This would require some
>> additional work for both the POSIX and GNU parsers. I
>> think that as the -D is associated with setting system
>> properties it should be treated as a special case.
>
> I have no problem using CLI now to deal with my -Dname
> or -Dname=value case.  I really think that this is something
> that's best left up to the application.
>
>> I am +1 for only treating -D as a special case as it is
>> a specific well defined special case.  If someone can
>> provide a good argument for "-[a-z]+", I will follow
>> that route.
>
> I guess I'm confused.  Will -D -always- set a java System
> property?  If so, I think that's overstepping our bounds.
>
> 	-bob
>
>
>
> --
> To unsubscribe, e-mail:   <mailto:commons-dev-
> unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:commons-dev-
> help@jakarta.apache.org>
>


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