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 <marc.khouzam@ville.montreal.qc.ca>
pull/5562/head
Marc Khouzam 7 years ago
parent f25729f234
commit d2ab3f5062

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

Loading…
Cancel
Save