Open radcortez opened 1 month ago
The picocli parser does not distinguish between =
or whitespace as the separator between options and their option parameter.
You will need to do some custom processing.
Please take a look at 11.15. Custom Parameter Processing in the user manual.
I looked at the linked Quarkus issue and now I'm a bit confused.
I thought the error would only occur when the user specified an exact option name as the value for another option, but it seems that the issue also occurs even if the value starts with an option name.
Away from my PC now, I'll take another look.
Meanwhile, before diving into Custom Processing, please check out this parser configuration option (11.9.2. Enable Consuming Option Names or Subcommands). This may solve the issue more simply.
I thought the error would only occur when the user specified an exact option name as the value for another option, but it seems that the issue also occurs even if the value starts with an option name.
Yes, correct. Sorry, I should have been more clear on that one. It does happen when the option value starts with another option. So:
new CommandLine(new DashedOption()).execute(new String[]{"--required=-xabc"});
This will also fail.
Meanwhile, before diving into Custom Processing, please check out this parser configuration option (11.9.2. Enable Consuming Option Names or Subcommands).
Thanks. I'll have a look.
Consider:
Output:
When one option value starts with another option it causes the error
Expected parameter for option '--required' but found '-x'
. Notice that it is perfectly fine to pass dashed values to a particular option value, but it fails if that value starts with another option.