-
Notifications
You must be signed in to change notification settings - Fork 445
Description
Follow-up on #979, #981, #370, #659
Any time an option has a range of parameters, like @Option(arity = "0..1") or @Option(arity = "1..*"), and the command also defines one or more positional parameters, there is ambiguity whether a command line parameter should be considered an option parameter or a positional parameter.
Sometimes it is possible to resolve the ambiguity locally, and picocli currently applies heuristics to determine if the value is a subcommand or (likely) another option.
In other cases, it may possible to resolve the ambiguity globally: if a command has an option with an optional parameter, and a required positional parameter, then interpreting the parameter following the option (--option value) as a positional parameter is the only interpretation that does not result in an error.
This requires the parser "marking" points of ambiguity and processing the input multiple times, using different interpretations of the "grammar" defined by the command options and parameters.