From d2ab3f5062467b66de8dc9728dd8c7509e8dcb07 Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Sat, 6 Apr 2019 12:31:37 -0400 Subject: [PATCH] Cannot have an = sign as an index Flags sometimes can be used with an = sign, such as --kube-context=prod. In this case, the variable ${flagname} retains the = sign as part of the flag name. However, in zsh completion, an = sign cannot be part of an index of the associative array 'flaghash' or else it causes an error. This commits strips the = sign out when using ${flagname} as an index. Note that this is not a big deal since flaghash is not actually used anywhere in Helm completion. I believe it is made available by the Cobra framework in case some completions choose to use it. Signed-off-by: Marc Khouzam --- cmd/helm/completion.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/helm/completion.go b/cmd/helm/completion.go index 039dcbe5f..53d1c21e5 100644 --- a/cmd/helm/completion.go +++ b/cmd/helm/completion.go @@ -213,6 +213,7 @@ __helm_convert_bash_to_zsh() { -e "s/${LWORD}declare${RWORD}/__helm_declare/g" \ -e "s/\\\$(type${RWORD}/\$(__helm_type/g" \ -e 's/aliashash\["\(.\{1,\}\)"\]/aliashash[\1]/g' \ + -e 's/flaghash\[${flagname/flaghash[${flagname%=/' \ -e 's/FUNCNAME/funcstack/g' \ <<'BASH_COMPLETION_EOF' `