Skip to content

Commit

Permalink
Fix debug printouts for zsh completion
Browse files Browse the repository at this point in the history
Cobra provides some out-of-the-box debugging for bash completion.
To use it, one must set the variable BASH_COMP_DEBUG_FILE to
some file where the debug output will be written.  Many of the
debug printouts indicate the current method name; they do so
by using bash's ${FUNCNAME[0]} variable. This variable is
different in zsh. To obtain the current method name in zsh
we must use ${funcstack[1]}.

This commit adds the proper sed modification to convert from
bash to zsh.

Signed-off-by: Marc Khouzam <marc.khouzam@ville.montreal.qc.ca>
  • Loading branch information
marckhouzam committed Mar 10, 2019
1 parent 367b6fc commit 4fec4b6
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions cmd/helm/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -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/FUNCNAME\[0\]/funcstack[1]/g' \
<<'BASH_COMPLETION_EOF'
`
out.Write([]byte(zshInitialization))
Expand Down

0 comments on commit 4fec4b6

Please sign in to comment.