Is this a bug? Or am I using this incorrectly?
I have an option with short and long values. Given code that is
essentially what is below, with a PosixParser I see results as follows:
A command line with just "-t" prints out the results of the catch block
(OK)
A command line with just "-target" prints out the results of the catch
block (OK)
A command line with just "-t foobar.com" prints out "processing selected
target: foobar.com" (OK)
A command line with just "-target foobar.com" prints out "processing
selected target: arget" (ERROR?)
========================================================================
=======================
private static final String OPTION_TARGET = "t";
private static final String OPTION_TARGET_LONG = "target";
// ...
Option generateTarget = new Option(OPTION_TARGET,
OPTION_TARGET_LONG,
true,
"Generate files for the specified
target machine");
// ...
try {
parsedLine = parser.parse(cmdLineOpts, args);
} catch (ParseException pe) {
System.out.println("Invalid command: " + pe.getMessage() +
"\n");
HelpFormatter hf = new HelpFormatter();
hf.printHelp(USAGE, cmdLineOpts);
System.exit(-1);
}
if (parsedLine.hasOption(OPTION_TARGET)) {
System.out.println("processing selected target: " +
parsedLine.getOptionValue(OPTION_TARGET));
}
--
To unsubscribe, e-mail: <mailto:commons-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@;jakarta.apache.org>