From b0d567accddbeefc697042eb24c4ac9bd9ba3264 Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Sun, 28 Jun 2020 19:17:20 -0400 Subject: [PATCH] feat(comp): Add descriptions for plugin completion Ref: HIP 0008 When completing a plugin name, extra information will be shown for shells that support completions (fish, zsh). For example: $ helm plugin uninstall 2to3 -- migrate and cleanup Helm v2 configuration and releases in-place to Helm v3 diff -- Preview helm upgrade changes as a diff fullstatus -- provide status of resources part of the release github -- Install or upgrade Helm charts from GitHub repos Signed-off-by: Marc Khouzam --- cmd/helm/plugin_list.go | 2 +- cmd/helm/testdata/output/plugin_list_comp.txt | 10 +++++----- cmd/helm/testdata/output/plugin_repeat_comp.txt | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cmd/helm/plugin_list.go b/cmd/helm/plugin_list.go index eb4e5c815..6c3926a9d 100644 --- a/cmd/helm/plugin_list.go +++ b/cmd/helm/plugin_list.go @@ -83,7 +83,7 @@ func compListPlugins(toComplete string, ignoredPluginNames []string) []string { filteredPlugins := filterPlugins(plugins, ignoredPluginNames) for _, p := range filteredPlugins { if strings.HasPrefix(p.Metadata.Name, toComplete) { - pNames = append(pNames, p.Metadata.Name) + pNames = append(pNames, fmt.Sprintf("%s\t%s", p.Metadata.Name, p.Metadata.Usage)) } } } diff --git a/cmd/helm/testdata/output/plugin_list_comp.txt b/cmd/helm/testdata/output/plugin_list_comp.txt index e33b6ce52..833efc5e9 100644 --- a/cmd/helm/testdata/output/plugin_list_comp.txt +++ b/cmd/helm/testdata/output/plugin_list_comp.txt @@ -1,7 +1,7 @@ -args -echo -env -exitwith -fullenv +args echo args +echo echo stuff +env env stuff +exitwith exitwith code +fullenv show env vars :4 Completion ended with directive: ShellCompDirectiveNoFileComp diff --git a/cmd/helm/testdata/output/plugin_repeat_comp.txt b/cmd/helm/testdata/output/plugin_repeat_comp.txt index 9e2ee56ab..3fa05f0b3 100644 --- a/cmd/helm/testdata/output/plugin_repeat_comp.txt +++ b/cmd/helm/testdata/output/plugin_repeat_comp.txt @@ -1,6 +1,6 @@ -echo -env -exitwith -fullenv +echo echo stuff +env env stuff +exitwith exitwith code +fullenv show env vars :4 Completion ended with directive: ShellCompDirectiveNoFileComp