Running invalid command causes kind CLI to exit with 0 #2087
Labels
kind/bug
Categorizes issue or PR as related to a bug.
priority/important-longterm
Important over the long term, but may not be staffed and/or may need multiple releases to complete.
Milestone
What happened:
For example
kind load typo
will exit with 0What you expected to happen:
Kind to exit with non-zero (Very useful when used in ci or script etc)
How to reproduce it (as minimally and precisely as possible):
Anything else we need to know?:
This is due to cobra (spf13/cobra#1156) and affects all commands that have sub-commands in kind (build, completion, create, delete, export, get, load)
The specified
NoArgs
or any of the cobra validators don't seem to have any effect unless Run or RunE has been defined for the command. One fix might be to just specify something like:to every command (or also have them return 0 in case called without arguments).
I implemented this locally and it seemed to work as it should. Although it's very far from an elegant solution since that would need to duplicated to all of the commands that have sub-commands.
If my (probably rather bad fix) seems reasonable I'm happy to create a PR, but I think this need a more elegant solution.
Environment:
kind version
):kind v0.10.0 go1.15.7 darwin/amd64
kubectl version
):docker info
):/etc/os-release
):The text was updated successfully, but these errors were encountered: