Diff
1diff --git a/plugins/nats/README.md b/plugins/nats/README.md
2new file mode 100644
3index 0000000000000000000000000000000000000000..0ea26fca18d4e328fe2287bc5053666370042292
4--- /dev/null
5+++ b/plugins/nats/README.md
6@@ -0,0 +1,14 @@
7+# NATS plugin
8+
9+This plugin adds completion for several tools from [NATS](https://nats.io/).
10+
11+- [`nsc`](https://github.com/nats-io/nsc)
12+- [`natscli`](https://github.com/nats-io/natscli)
13+
14+To use it, add `nats` to the plugins array in your zshrc file:
15+
16+```zsh
17+plugins=(... nats)
18+```
19+
20+This plugin does not add any aliases.
21diff --git a/plugins/nats/nats.plugin.zsh b/plugins/nats/nats.plugin.zsh
22new file mode 100644
23index 0000000000000000000000000000000000000000..8b95b07c6a1d5e53cf9682ff3eefa4197fe7b6e0
24--- /dev/null
25+++ b/plugins/nats/nats.plugin.zsh
26@@ -0,0 +1,23 @@
27+if (( $+commands[nsc] )); then
28+ # If the completion file doesn't exist yet, we need to autoload it and
29+ # bind it to `nsc`. Otherwise, compinit will have already done that.
30+ if [[ ! -f "$ZSH_CACHE_DIR/completions/_nsc" ]]; then
31+ typeset -g -A _comps
32+ autoload -Uz _nsc
33+ _comps[nsc]=_nsc
34+ fi
35+
36+ nsc completion zsh >| "$ZSH_CACHE_DIR/completions/_nsc" &|
37+fi
38+
39+if (( $+commands[nats] )); then
40+ # If the completion file doesn't exist yet, we need to autoload it and
41+ # bind it to `nats`. Otherwise, compinit will have already done that.
42+ if [[ ! -f "$ZSH_CACHE_DIR/completions/_nats" ]]; then
43+ typeset -g -A _comps
44+ autoload -Uz _nats
45+ _comps[nats]=_nats
46+ fi
47+
48+ nats --completion-script-zsh >| "$ZSH_CACHE_DIR/completions/_nats" &|
49+fi
50diff --git a/plugins/nsc/README.md b/plugins/nsc/README.md
51deleted file mode 100644
52index ce0d2c15cc97ef23bb63a49b5d923c85ddcefa63..0000000000000000000000000000000000000000
53--- a/plugins/nsc/README.md
54+++ /dev/null
55@@ -1,11 +0,0 @@
56-# NSC plugin
57-
58-This plugin adds completion for the [NSC](https://github.com/nats-io/nsc).
59-
60-To use it, add `nsc` to the plugins array in your zshrc file:
61-
62-```zsh
63-plugins=(... nsc)
64-```
65-
66-This plugin does not add any aliases.
67diff --git a/plugins/nsc/nsc.plugin.zsh b/plugins/nsc/nsc.plugin.zsh
68deleted file mode 100644
69index daa599e8f7b157869c40591ab7a1d83b3e300bf9..0000000000000000000000000000000000000000
70--- a/plugins/nsc/nsc.plugin.zsh
71+++ /dev/null
72@@ -1,13 +0,0 @@
73-if (( ! $+commands[nsc] )); then
74- return
75-fi
76-
77-# If the completion file doesn't exist yet, we need to autoload it and
78-# bind it to `nsc`. Otherwise, compinit will have already done that.
79-if [[ ! -f "$ZSH_CACHE_DIR/completions/_nsc" ]]; then
80- typeset -g -A _comps
81- autoload -Uz _nsc
82- _comps[nsc]=_nsc
83-fi
84-
85-nsc completion zsh >| "$ZSH_CACHE_DIR/completions/_nsc" &|