This repository has been archived by the owner on Jul 17, 2024. It is now read-only.
Use Cobra to provide all shell completions #199
Closed
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.
This comes a little late since this project is pretty stable but I have been working on making this happen for 18 months (spf13/cobra#1161), so here it is anyway.
Cobra automatically provides support for flag and command completion. By using helm's dynamic completion for plugins, we can use Cobra's support in a
plugin.complete
file instead of coding things ourselves incompletion.yaml
.This removes the need to keep the now removed
completion.yaml
up to date with any new command or flag.This change requires the use of Helm 3.8 that uses Cobra 1.3.
So, this change will cause a regression to shell completion for older versions of helm, so I'm not sure if we want the change or not, but I wanted to at least suggest it.
Furthermore, with this change, adding shell completions for release names and such in helm-2to3 would then automatically work when used as a plugin.