diff options
author | Lorenzo Bolla <lorenzo.bolla@yougov.com> | 2018-05-20 13:46:27 +0100 |
---|---|---|
committer | Lorenzo Bolla <lorenzo.bolla@yougov.com> | 2018-05-20 13:46:27 +0100 |
commit | 2956e7820ee1dd7111084a291722c12aea01bb5c (patch) | |
tree | bbd5d59fa81cdc4e400143627603796e5233b3ca | |
parent | a600ab4b8578ca0a8e6c6dae0373033b9d8c201c (diff) | |
download | zsh-2956e7820ee1dd7111084a291722c12aea01bb5c.tar.gz zsh-2956e7820ee1dd7111084a291722c12aea01bb5c.tar.bz2 zsh-2956e7820ee1dd7111084a291722c12aea01bb5c.zip |
Fix 6843 Cache kubectl completion script to file to speed up sourcing
-rw-r--r-- | plugins/kubectl/kubectl.plugin.zsh | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh index ec1321d8b..f4062186a 100644 --- a/plugins/kubectl/kubectl.plugin.zsh +++ b/plugins/kubectl/kubectl.plugin.zsh @@ -2,8 +2,15 @@ # # Author: https://github.com/pstadler +KUBECTL_COMPLETION_FILENAME="$TMPPREFIX-kubectl-completion-zsh" + +if [[ ! -f "$KUBECTL_COMPLETION_FILENAME" ]] +then + kubectl completion zsh > "$KUBECTL_COMPLETION_FILENAME" +fi + if [ $commands[kubectl] ]; then - source <(kubectl completion zsh) + source "$KUBECTL_COMPLETION_FILENAME" fi # This command is used ALOT both below and in daily life |