This repository has been archived by the owner on Oct 10, 2023. It is now read-only.
Hide the default completion command of plugins #3888
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it
Plugins automatically get a default
completion
command from Cobra. For example:This commit hides this default command for any plugin through the plugin runtime library.
Notice that users enable shell completion using
tanzu completion
, and that this allows completion to work for plugins as well. Therefore plugins do not need to also have their owncompletion
command. Having such a command for a plugin (e.g.,tanzu cluster completion
) is just confusing for users.Which issue(s) this PR fixes
Fixes #3160
Describe testing done for PR
I built the CLI and the plugins and then ran
and confirmed there was no
completion
command listed.I then ran
and confirmed the command still existed but is simply hidden.
The reasons for keeping it hidden instead of removing it is explained in the section below.
Release note
Additional information
We don't completely disable a plugin's default completion command for two reasons:
Note that a plugin can completely disable this command itself using:
Special notes for your reviewer
This change impacts all plugins that will be compiled with this new version of the runtime library.