From 74420341df46fab5cf34f24917927d675d717102 Mon Sep 17 00:00:00 2001 From: Pavel Fokin Date: Mon, 2 Mar 2020 14:20:28 +0200 Subject: [PATCH] minikube: cache command completions (#7446) --- plugins/minikube/minikube.plugin.zsh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/plugins/minikube/minikube.plugin.zsh b/plugins/minikube/minikube.plugin.zsh index d8ebe79af..f7b365c7f 100644 --- a/plugins/minikube/minikube.plugin.zsh +++ b/plugins/minikube/minikube.plugin.zsh @@ -1,6 +1,13 @@ # Autocompletion for Minikube. # +if (( $+commands[minikube] )); then + __MINICUBE_COMPLETION_FILE="${ZSH_CACHE_DIR}/minicube_completion" -if [ $commands[minikube] ]; then - source <(minikube completion zsh) + if [[ ! -f $__MINICUBE_COMPLETION_FILE ]]; then + minikube completion zsh >! $__MINICUBE_COMPLETION_FILE + fi + + [[ -f $__MINICUBE_COMPLETION_FILE ]] && source $__MINICUBE_COMPLETION_FILE + + unset __MINICUBE_COMPLETION_FILE fi