mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-13 13:55:41 +00:00
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:
parent
45e557e237
commit
1ea3da1eb6
@ -245,7 +245,8 @@ if sed --help 2>&1 | grep -q GNU; then
|
|||||||
RWORD='\>'
|
RWORD='\>'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
__kubectl_bash_source <(sed \
|
__kubectl_convert_bash_to_zsh() {
|
||||||
|
sed \
|
||||||
-e 's/declare -F/whence -w/' \
|
-e 's/declare -F/whence -w/' \
|
||||||
-e 's/local \([a-zA-Z0-9_]*\)=/local \1; \1=/' \
|
-e 's/local \([a-zA-Z0-9_]*\)=/local \1; \1=/' \
|
||||||
-e 's/flags+=("\(--.*\)=")/flags+=("\1"); two_word_flags+=("\1")/' \
|
-e 's/flags+=("\(--.*\)=")/flags+=("\1"); two_word_flags+=("\1")/' \
|
||||||
@ -267,7 +268,9 @@ __kubectl_bash_source <(sed \
|
|||||||
|
|
||||||
zsh_tail := `
|
zsh_tail := `
|
||||||
BASH_COMPLETION_EOF
|
BASH_COMPLETION_EOF
|
||||||
)
|
}
|
||||||
|
|
||||||
|
__kubectl_bash_source <(__kubectl_convert_bash_to_zsh)
|
||||||
`
|
`
|
||||||
out.Write([]byte(zsh_tail))
|
out.Write([]byte(zsh_tail))
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user