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

If the CLI shows help because of a malformed command, but --help was not passed, return nonzero #3466

Open
MatrixManAtYrService opened this issue Dec 30, 2023 · 4 comments · May be fixed by #3573
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@MatrixManAtYrService
Copy link

Thanks for your work on kind, it's very helpful.


I mistyped a command: kind clusters get. That's not how the CLI works. It should have been kind get clusters.

Helpfully, kind showed me the help. Unhelpfully, kind returned 0, as if everything had gone according to plan. Later, I tried to recall this command via fzf, expecting to chose from a list of past successes.

Instead I was shown both failures and successes:

  • kind get clusters
  • kind clusters get

This happened because kind returned 0 for both, so my history search couldn't tell the successes from the failures.

Git behaves appropriately:

$ git status > /dev/null && echo good || echo bad
good
$ git schmatus 2> /dev/null && echo good || echo bad
bad

Kind does not:

$ kind get clusters > /dev/null && echo good || echo bad
good
$ kind clusters get > /dev/null && echo good || echo bad
good

Environment:

  • kind version: (use kind version):
kind v0.20.0 go1.21.3 darwin/amd64
@MatrixManAtYrService MatrixManAtYrService added the kind/bug Categorizes issue or PR as related to a bug. label Dec 30, 2023
@BenTheElder
Copy link
Member

Good catch!
/triage accepted

@k8s-ci-robot k8s-ci-robot added the triage/accepted Indicates an issue or PR is ready to be actively worked on. label Jan 2, 2024
@kevinmingtarja
Copy link

Hi, I'd like to contribute a fix if no one's working on it!

@tomgoren
Copy link

tomgoren commented Mar 3, 2024

AFAICT this is relate to how Cobra is set up here.

I'm not entirely sure how to fix this (yet), just sharing my initial thoughts on this in case anyone else has a hint. I'm happy to pick this up if I can figure it out. This is another source of possibly related information 🤷 .

@yashvardhan-kukreja
Copy link
Contributor

Hi everyone, considering the inactivity of this issue since the past few months and no assignment on it, I would love to assign myself to it and proceed with its contribution

/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. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants