args4j
args4j copied to clipboard
Parsing with option value delimiter other than "=" does not work
In this commit CommandLineParser
was modified to use parserProperties.getOptionValueDelimiter()
instead of supporting only "=" as a delimiter.
However, it appears as though the splitToken()
method inside of CmdLineImpl
was missed in this change:
/**
* Used when the current token is of the form "-option=value",
* to replace the current token by "value", as if this was given as two tokens "-option value"
*/
void splitToken() {
if (pos < args.length && pos >= 0) {
int idx = args[pos].indexOf("=");
if (idx > 0) {
args[pos] = args[pos].substring(idx + 1);
}
}
}
It is still using a hard-coded equals sign to determine the index of the parameter to remove instead of calling parserProperties.getOptionValueDelimiter()
.
This means that, for example, when I change the option value delimiter to ":", and try and parse something like "-e:testing" what gets passed through as a parameter value is "-e:testing" when I would expect to have just "testing" as a value.
@kohsuke I have implemented a fix for this issue, and I would like to contribute it. Could you please give me permission to push up a branch and create a PR?
Scratch that, PR opened!