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 <TAB>
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 <marc.khouzam@montreal.ca>
pull/9243/head
Marc Khouzam 5 years ago
parent a6b28348df
commit b0d567accd

@ -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))
}
}
}

@ -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

@ -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

Loading…
Cancel
Save