From 176376cbc026bb5339a00a6486882649d250469a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sat, 17 Oct 2020 23:14:58 +0200 Subject: [PATCH] kubectl: check for empty cache completion file --- plugins/kubectl/kubectl.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh index 7a0c47945..0b1edb450 100644 --- a/plugins/kubectl/kubectl.plugin.zsh +++ b/plugins/kubectl/kubectl.plugin.zsh @@ -1,7 +1,7 @@ if (( $+commands[kubectl] )); then __KUBECTL_COMPLETION_FILE="${ZSH_CACHE_DIR}/kubectl_completion" - if [[ ! -f $__KUBECTL_COMPLETION_FILE ]]; then + if [[ ! -f $__KUBECTL_COMPLETION_FILE || ! -s $__KUBECTL_COMPLETION_FILE ]]; then kubectl completion zsh >! $__KUBECTL_COMPLETION_FILE fi @@ -151,7 +151,7 @@ alias kdpvc='kubectl describe pvc' alias kdelpvc='kubectl delete pvc' # Only run if the user actually has kubectl installed -if (( $+commands[kubectl] )); then +if (( ${+_comps[kubectl]} )); then kj() { kubectl "$@" -o json | jq; } kjx() { kubectl "$@" -o json | fx; } ky() { kubectl "$@" -o yaml | yh; }