Hello,

I think there is an inconsistency in the method Options.hasOption(String).
The Javadoc mentions that the method argument is either the long or short
name of the option. However, the following snippet doesn't give me the
expected results.

org.apache.commons.cli.Options options = new
org.apache.commons.cli.Options();
options.addOption(org.apache.commons.cli.OptionBuilder
.withLongOpt("cluster")
.create());

System.out.println("Has long  'cluster' option? " +
options.hasOption("cluster"));
System.out.println("Has short 'cluster' option? " + options.hasOption(" "));

The output is:

Has long  'cluster' option? false
Has short 'cluster' option? true

However, if I specify this:

System.out.println("Has long  'cluster' option? " +
options.hasOption("--cluster"));

The output is:

Has long  'cluster' option? true

Why should I specify the "--" for the long option and not "-" for the short
one? I think you should only have to specify the short or long option name
withouth any colon (as documented).

Ringo

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

Reply via email to