Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Actual error hidden behind unknown flag error #2022

Closed
Adirio opened this issue Feb 17, 2021 · 1 comment · Fixed by #2023
Closed

🐛 Actual error hidden behind unknown flag error #2022

Adirio opened this issue Feb 17, 2021 · 1 comment · Fixed by #2023
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@Adirio
Copy link
Contributor

Adirio commented Feb 17, 2021

When the user provides some wrong flags, the error is reported with a help message for the root command.

For example: kubebuilder init --project-version=2 --plugins=go/v3 will print:

Error:  no plugin could be resolved with key "go/v3" for project version "2"
Usage:
  kubebuilder [flags]

Examples:
[...]
[DATE] no plugin could be resolved with key "go/v3" for project version "2"

If an additional flag is provided, even if its valid for the subcommand, it won't be valid for the root command used to print the help message, so the error will change to unknow flag: --flag hiding te real error.

For example, adding the --domain flag to the previous call (which is a valid init flag): kubebuilder init --project-version=2 --plugins=go/v3 --domain=my.domain will print:

Error:  unknown flag: --domain
Usage:
  kubebuilder [flags]

Examples:
[...]
[DATE] unknown flag: --domain

The --domain flag is obviously not the problem here so the provided error message will only lead the user in the wrong direction.

/kind bug

@Adirio
Copy link
Contributor Author

Adirio commented Feb 17, 2021

/assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
2 participants