You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running the command with arguments fooasdf -o=bar returns a usage error, return code 127.
However, running the command with arguments fooasdf -o=foo does not return an error, and instead sets the subcommand to foo. This is incorrect - this example should exit 127 just as above.
This problem was seen in hashicorp/terraform#30870, in which terraform planasdf -out tfplan, which should error, instead behaves as if the user had run terraform plan -out tfplan.
Consider a command with a single subcommand
foo
.Running the command with arguments
fooasdf -o=bar
returns a usage error, return code 127.However, running the command with arguments
fooasdf -o=foo
does not return an error, and instead sets the subcommand tofoo
. This is incorrect - this example should exit 127 just as above.This problem was seen in hashicorp/terraform#30870, in which
terraform planasdf -out tfplan
, which should error, instead behaves as if the user had runterraform plan -out tfplan
.The problem seems to be that the subcommand matching logic at https://github.com/mitchellh/cli/blob/master/cli.go#L704 is too liberal, and identifies any string both prefixed and suffixed by a subcommand as that subcommand.
The text was updated successfully, but these errors were encountered: