Fix named pipe in kubectl zsh completion

In zsh and bash, a multi-line named pipe, who is wrapped by
parenthesis, is possible to mismatch the right parenthesis, even that
parenthesis is in a here-document. So, we move the code into a
function, and use an inline named pipe.

Signed-off-by: ohmystack <jiangjun1990@gmail.com>
This commit is contained in:
ohmystack 2016-08-23 01:42:05 +08:00
parent 45e557e237
commit 1ea3da1eb6

View File

@ -245,7 +245,8 @@ if sed --help 2>&1 | grep -q GNU; then
RWORD='\>'
fi
__kubectl_bash_source <(sed \
__kubectl_convert_bash_to_zsh() {
sed \
-e 's/declare -F/whence -w/' \
-e 's/local \([a-zA-Z0-9_]*\)=/local \1; \1=/' \
-e 's/flags+=("\(--.*\)=")/flags+=("\1"); two_word_flags+=("\1")/' \
@ -267,7 +268,9 @@ __kubectl_bash_source <(sed \
zsh_tail := `
BASH_COMPLETION_EOF
)
}
__kubectl_bash_source <(__kubectl_convert_bash_to_zsh)
`
out.Write([]byte(zsh_tail))
return nil