args4j
args4j copied to clipboard
Wrong operand name displayed when "key=value" syntax is used
Multiple OptionHandler sub-classes use Parameters#getParameter(...) with -1 as the index parameter, e.g. EnumOptionHandler.
This approach does not work when the "key=value" syntax is used, see splitToken() in CmdLineParser.CmdLineImpl for why this is not working.
FWIW,
Minimal code to reproduce
import org.kohsuke.args4j.CmdLineParser;
import org.kohsuke.args4j.Option;
public class Foo {
@Option(name = "--foo")
String foo;
@Option(name = "--val")
int val;
public static void main(String[] args) throws Exception {
new CmdLineParser(new Foo())
.parseArgument(new String[] {
"--foo=bar",
"--val=abc",
});
}
}
throws:
org.kohsuke.args4j.CmdLineException: "abc" is not a valid value for "bar"