From 53c836375d0795d53f5fc682d14da4858967da4d Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Wed, 21 Aug 2019 20:50:42 -0400 Subject: [PATCH] feat(helm): Complete for helm plugin remove/update helm repo remove (will select from the names of configured repos) helm plugin remove (will select from names of installed plugins) helm plugin update (will select from names of installed plugins) Signed-off-by: Marc Khouzam --- cmd/helm/helm.go | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/cmd/helm/helm.go b/cmd/helm/helm.go index 49e1d64a3..0b60842f2 100644 --- a/cmd/helm/helm.go +++ b/cmd/helm/helm.go @@ -80,7 +80,6 @@ __helm_list_releases() fi } - __helm_list_repos() { __helm_debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}" @@ -92,6 +91,17 @@ __helm_list_repos() fi } +__helm_list_plugins() +{ + __helm_debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}" + local out oflags + oflags=$(__helm_override_flags) + __helm_debug "${FUNCNAME[0]}: __helm_override_flags are ${oflags}" + if out=$(helm plugin list ${oflags} | tail +2 | cut -f1 2>/dev/null); then + COMPREPLY=( $( compgen -W "${out[*]}" -- "$cur" ) ) + fi +} + __helm_custom_func() { __helm_debug "${FUNCNAME[0]}: c is $c words[@] is ${words[@]}" @@ -100,11 +110,15 @@ __helm_custom_func() helm_upgrade | helm_rollback | helm_get_*) __helm_list_releases return - ;; + ;; helm_repo_remove) __helm_list_repos return ;; + helm_plugin_remove | helm_plugin_update) + __helm_list_plugins + return + ;; *) ;; esac