summaryrefslogtreecommitdiff
path: root/plugins/nats/nats.plugin.zsh
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2023-03-18 16:23:39 -0700
committerTuowen Zhao <ztuowen@gmail.com>2023-03-18 16:23:39 -0700
commit4b0bbc0b263a150eb9a9b59f196914629be06a9b (patch)
tree619723cfa449f93149b766ee397f85ce2acef5f7 /plugins/nats/nats.plugin.zsh
parentdb7efd2336e4dbe6abf321b00dbc11bc5afb1355 (diff)
parent72732a224e886933df6b64a49ec6f5e94c884612 (diff)
downloadzsh-4b0bbc0b263a150eb9a9b59f196914629be06a9b.tar.gz
zsh-4b0bbc0b263a150eb9a9b59f196914629be06a9b.tar.bz2
zsh-4b0bbc0b263a150eb9a9b59f196914629be06a9b.zip
Merge remote-tracking branch 'github/master'
Diffstat (limited to 'plugins/nats/nats.plugin.zsh')
-rw-r--r--plugins/nats/nats.plugin.zsh23
1 files changed, 23 insertions, 0 deletions
diff --git a/plugins/nats/nats.plugin.zsh b/plugins/nats/nats.plugin.zsh
new file mode 100644
index 000000000..8b95b07c6
--- /dev/null
+++ b/plugins/nats/nats.plugin.zsh
@@ -0,0 +1,23 @@
+if (( $+commands[nsc] )); then
+ # If the completion file doesn't exist yet, we need to autoload it and
+ # bind it to `nsc`. Otherwise, compinit will have already done that.
+ if [[ ! -f "$ZSH_CACHE_DIR/completions/_nsc" ]]; then
+ typeset -g -A _comps
+ autoload -Uz _nsc
+ _comps[nsc]=_nsc
+ fi
+
+ nsc completion zsh >| "$ZSH_CACHE_DIR/completions/_nsc" &|
+fi
+
+if (( $+commands[nats] )); then
+ # If the completion file doesn't exist yet, we need to autoload it and
+ # bind it to `nats`. Otherwise, compinit will have already done that.
+ if [[ ! -f "$ZSH_CACHE_DIR/completions/_nats" ]]; then
+ typeset -g -A _comps
+ autoload -Uz _nats
+ _comps[nats]=_nats
+ fi
+
+ nats --completion-script-zsh >| "$ZSH_CACHE_DIR/completions/_nats" &|
+fi