diff --git a/cmd/helm/root.go b/cmd/helm/root.go index 69981ca01..74080ef0c 100644 --- a/cmd/helm/root.go +++ b/cmd/helm/root.go @@ -89,32 +89,46 @@ __helm_get_namespaces() fi } +__helm_binary_name() +{ + local helm_binary + helm_binary="${words[0]}" + __helm_debug "${FUNCNAME[0]}: helm_binary is ${helm_binary}" + echo ${helm_binary} +} + __helm_list_releases() { __helm_debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}" local out filter # Use ^ to map from the start of the release name filter="^${words[c]}" - if out=$(helm list $(__helm_override_flags) -a -q -m 1000 -f ${filter} 2>/dev/null); then + # Use eval in case helm_binary_name or __helm_override_flags contains a variable (e.g., $HOME/bin/h3) + if out=$(eval $(__helm_binary_name) list $(__helm_override_flags) -a -q -m 1000 -f ${filter} 2>/dev/null); then COMPREPLY=( $( compgen -W "${out[*]}" -- "$cur" ) ) fi } + __helm_list_repos() { __helm_debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}" local out - if out=$(helm repo list 2>/dev/null | tail +2 | cut -f1); then + # Use eval in case helm_binary_name contains a variable (e.g., $HOME/bin/h3) + if out=$(eval $(__helm_binary_name) repo list 2>/dev/null | tail +2 | cut -f1); 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 2>/dev/null | tail +2 | cut -f1); then + # Use eval in case helm_binary_name contains a variable (e.g., $HOME/bin/h3) + if out=$(eval $(__helm_binary_name) plugin list 2>/dev/null | tail +2 | cut -f1); then COMPREPLY=( $( compgen -W "${out[*]}" -- "$cur" ) ) fi } + __helm_custom_func() { __helm_debug "${FUNCNAME[0]}: last_command is $last_command"