9c2d1af8afa02b5439e8ccc81a160e62e1e59617

Author
Andrew Starr-Bochicchio <andrewsomething@users.noreply.github.com>
Committer
GitHub <noreply@github.com>
Date

Message

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

Diff

 1diff --git a/plugins/doctl/doctl.plugin.zsh b/plugins/doctl/doctl.plugin.zsh
 2index d23ed085c091249667bc069ece42a1dedfeb9ecd..7b3a384a9a2ffaa25d23fa1a1cbb78de69f97e3d 100644
 3--- a/plugins/doctl/doctl.plugin.zsh
 4+++ b/plugins/doctl/doctl.plugin.zsh
 5@@ -4,6 +4,14 @@
 6 #
 7 # Author: https://github.com/HalisCz
 8 
 9-if [ $commands[doctl] ]; then
10-  source <(doctl completion zsh)
11+if (( ! $+commands[doctl] )); then
12+  return
13 fi
14+
15+if [[ ! -f "$ZSH_CACHE_DIR/completions/_doctl" ]]; then
16+  typeset -g -A _comps
17+  autoload -Uz _doctl
18+  _comps[doctl]=_doctl
19+fi
20+
21+doctl completion zsh >| "$ZSH_CACHE_DIR/completions/_doctl" &|