commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Menke Jörg,E2" <>
Subject AW: [CLI] RESEND: Inconsistency in Options.hasOption(String)
Date Tue, 18 Feb 2003 15:49:54 GMT
Hash: SHA1

Hi John!
> I have a new design of CLI nearly implemented.  I currently 
> require the '-' or '--' to be prefixed to the option name or
> longName respectively.
> I am going to investigate whether it will be possible to
> avoid the use of the hyphen in any situation i.e. no
> matter if you use it to refer to a long or short option.
> This might require a caveat like, a short option and a
> long option cannot have the same name e.g.
> Option c = OptionBuilder.create( "c", "create" );
> Option create = OptionBuilder.create( "create", "createArchive" );
> so the following call would be ambiguous:
> cmdline.getValue( "create" );
> should this return the value for Option 'c' or Option 'create'??
IMHO it should throw an error in that case as a combination like that
is far away from beeing user-friendly... But as user-friendlyness
might be a "personal thing" you could do it as you said: take a hyphon
or two to make it clear. But I personally would prefer the first

Another thing I mailed you about a while ago (and also sent a testcase
(which worked for whatever reason)):
Can your new option handle something like that:

Option a = OptionBuilder.hasArg(true).create( "b", "begin" );
Option a2 = OptionBuilder.create( "1" ); // begin at step 1
Option create = OptionBuilder.create( "create", "createArchive" );

And then call the app with -b 1

This throws "no argument for b" in the last version I tried for
whatever reason. I had no time to look at the source yet but I think
that is because 1 is an option, too.

regards, Jörg

Version: PGP 6.0.2


View raw message