浏览代码

fix(doctl): actually load completions (#11402)

Andrew Starr-Bochicchio 1 年之前
父节点
当前提交
9c2d1af8af
共有 1 个文件被更改,包括 10 次插入2 次删除
  1. 10 2
      plugins/doctl/doctl.plugin.zsh

+ 10 - 2
plugins/doctl/doctl.plugin.zsh

@@ -4,6 +4,14 @@
 #
 # Author: https://github.com/HalisCz
 
-if [ $commands[doctl] ]; then
-  source <(doctl completion zsh)
+if (( ! $+commands[doctl] )); then
+  return
 fi
+
+if [[ ! -f "$ZSH_CACHE_DIR/completions/_doctl" ]]; then
+  typeset -g -A _comps
+  autoload -Uz _doctl
+  _comps[doctl]=_doctl
+fi
+
+doctl completion zsh >| "$ZSH_CACHE_DIR/completions/_doctl" &|