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

Fix output usage for flux get <sources|images> #2347

Merged
merged 1 commit into from
Jan 27, 2022

Conversation

stealthybox
Copy link
Member

@stealthybox stealthybox commented Jan 26, 2022

Fixes #2346

Background:

Cobra will automatically print Usage for commands that do not have a .RunE.
All of the flux get command tree (including the flux get root) have --watch/-w
registered as a PersistentFlag.
The validateWatchOption() func is used to short circuit runnable sub-commands that
operate on multiple kinds, since the watch is not designed to stream/output multiple GVK's.

Justification:

These commands are runnable and need filtering:

  • flux get all
  • flux get sources all
  • flux get images all

These commands are not runnable, so there should be no RunE at all:

  • flux get sources
  • flux get images

Current Bug/Inconsistency:

$ flux get sources
# outputs nothing

$ flux get sources -w
✗ expected a single resource type, but found sources

$ flux get images
# outputs nothing

$ flux get images -w
✗ expected a single resource type, but found images

however:

$ flux get
# outputs Usage

$ flux get -w
# still outputs Usage

Result of this patch:

$ flux get sources
# outputs Usage

$ flux get sources -w
# outputs Usage

$ flux get images
# outputs Usage

$ flux get images -w
# outputs Usage

ps:
I miss you nerds
much love from the tanzu team

Signed-off-by: leigh capili <leigh@null.net>
@kingdonb
Copy link
Member

Thanks for explaining @stealthybox this is very helpful information, I can confirm this addresses the issue after running it locally 👍 we nerds miss you as well!

Copy link
Member

@stefanprodan stefanprodan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Thanks @stealthybox 🏅

@stefanprodan stefanprodan changed the title Output Usage for flux get <sources|images> Fix output usage for flux get <sources|images> Jan 27, 2022
@stefanprodan stefanprodan merged commit 920d6e5 into fluxcd:main Jan 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

flux get sources - no output
3 participants