9b11b7e9388dc8c736c321e56e29440dedfa6152

Author
Marc Cornellà <marc.cornella@live.com>
Committer
GitHub <noreply@github.com>
Date

Message

Update logic to follow npm plugin convention

Diff

 1diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh
 2index f4062186acca3053fc618a019b72845724d3c82a..c4e30dacda6b30226b7b12d5e5f26c6da503bf17 100644
 3--- a/plugins/kubectl/kubectl.plugin.zsh
 4+++ b/plugins/kubectl/kubectl.plugin.zsh
 5@@ -1,16 +1,13 @@
 6-# Autocompletion for kubectl, the command line interface for Kubernetes
 7-#
 8-# Author: https://github.com/pstadler
 9+if (( $+commands[kubectl] )); then
10+    __KUBECTL_COMPLETION_FILE="${ZSH_CACHE_DIR}/kubectl_completion"
11 
12-KUBECTL_COMPLETION_FILENAME="$TMPPREFIX-kubectl-completion-zsh"
13+    if [[ ! -f $__KUBECTL_COMPLETION_FILE ]]; then
14+        kubectl completion zsh >! $__KUBECTL_COMPLETION_FILE
15+    fi
16 
17-if [[ ! -f "$KUBECTL_COMPLETION_FILENAME" ]]
18-then
19-    kubectl completion zsh > "$KUBECTL_COMPLETION_FILENAME"
20-fi
21+    [[ -f $__KUBECTL_COMPLETION_FILE ]] && source $__KUBECTL_COMPLETION_FILE
22 
23-if [ $commands[kubectl] ]; then
24-  source "$KUBECTL_COMPLETION_FILENAME"
25+    unset __KUBECTL_COMPLETION_FILE
26 fi
27 
28 # This command is used ALOT both below and in daily life