Open skyzyx opened 3 years ago
@skyzyx Here's how mow.cli parses the spec string [--cluster=<value> [--only-env=<value>] | --all]
:
However,by adding parenthesis to get this spec string: [(--cluster=<value> [--only-env=<value>]) | --all]
, this nudges the parser into what you want:
You are right that the doc does not explain precedence/associativity rules, which needs to be fixed.
Ahhh. I had assumed that the left side of |
was auto-grouped.
[ natural-group-1 | natural-group-2 ]
I've discovered something which violates the Principle of Least Surprise and think that it may be a bug.
I have a spec which looks like this:
When I run the command with an option, I get the following:
However, if I reverse the top level options in a way that is semantically identical:
…it works without issue.
I've read through the text about this in the README, and I didn't find this specifically called-out. As a result, I think it's a parser issue. It's taking position into account in a place where it shouldn't.