helm-v3: Dynamic completion for "helm repo" and "helm plugin" (#6263)

* Add dynamic completion for 'helm repo remove'

Signed-off-by: Marc Khouzam <marc.khouzam@ville.montreal.qc.ca>

* fix: --home flag has been removed

Signed-off-by: Marc Khouzam <marc.khouzam@ville.montreal.qc.ca>

* Dynamic completion for 'helm plugin remove/update'

Signed-off-by: Marc Khouzam <marc.khouzam@ville.montreal.qc.ca>

* Add returns for consitency

Signed-off-by: Marc Khouzam <marc.khouzam@ville.montreal.qc.ca>
pull/6335/head
Marc Khouzam 6 years ago committed by Martin Hickey
parent 26c7338408
commit 2aa4a6bc92

@ -28,7 +28,7 @@ import (
const ( const (
bashCompletionFunc = ` bashCompletionFunc = `
__helm_override_flag_list=(--kubeconfig --kube-context --home --namespace -n) __helm_override_flag_list=(--kubeconfig --kube-context --namespace -n)
__helm_override_flags() __helm_override_flags()
{ {
local ${__helm_override_flag_list[*]##*-} two_word_of of var local ${__helm_override_flag_list[*]##*-} two_word_of of var
@ -65,6 +65,22 @@ __helm_list_releases()
COMPREPLY=( $( compgen -W "${out[*]}" -- "$cur" ) ) COMPREPLY=( $( compgen -W "${out[*]}" -- "$cur" ) )
fi fi
} }
__helm_list_repos()
{
__helm_debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}"
local out
if out=$(helm repo list | tail +2 | cut -f1 2>/dev/null); then
COMPREPLY=( $( compgen -W "${out[*]}" -- "$cur" ) )
fi
}
__helm_list_plugins()
{
__helm_debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}"
local out
if out=$(helm plugin list | tail +2 | cut -f1 2>/dev/null); then
COMPREPLY=( $( compgen -W "${out[*]}" -- "$cur" ) )
fi
}
__helm_custom_func() __helm_custom_func()
{ {
__helm_debug "${FUNCNAME[0]}: last_command is $last_command" __helm_debug "${FUNCNAME[0]}: last_command is $last_command"
@ -74,6 +90,14 @@ __helm_custom_func()
__helm_list_releases __helm_list_releases
return return
;; ;;
helm_repo_remove)
__helm_list_repos
return
;;
helm_plugin_remove | helm_plugin_update)
__helm_list_plugins
return
;;
*) *)
;; ;;
esac esac

Loading…
Cancel
Save