-
Notifications
You must be signed in to change notification settings - Fork 57
Open
Description
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:
cmd.Spec = `[--cluster=<value> [--only-env=<value>] | --all]`When I run the command with an option, I get the following:
$ mkit module newrelic plan --all
Error: incorrect usage
Usage: mkit module newrelic plan [--cluster=<value> [--only-env=<value>] | --all]
Executes `terraform plan` for the specified Terraform module.
Options:
-c, --cluster The friendly name of the cluster that you want to execute against. (Not compatible with --all.)
-e, --only-env Used for limiting the execution to a single environment. (Not compatible with --all; requires --cluster.)
-a, --all Execute for all clusters at once. (Not compatible with --cluster.)However, if I reverse the top level options in a way that is semantically identical:
cmd.Spec = `[--all | --cluster=<value> [--only-env=<value>]]`…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.
Metadata
Metadata
Assignees
Labels
No labels