summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/charm/README.md9
-rw-r--r--plugins/charm/charm.plugin.zsh14
2 files changed, 23 insertions, 0 deletions
diff --git a/plugins/charm/README.md b/plugins/charm/README.md
new file mode 100644
index 000000000..f237dceeb
--- /dev/null
+++ b/plugins/charm/README.md
@@ -0,0 +1,9 @@
+# Charm plugin
+
+This plugin adds completion for the [charm](https://github.com/charmbracelet/charm) CLI.
+
+To use it, add `charm` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... charm)
+```
diff --git a/plugins/charm/charm.plugin.zsh b/plugins/charm/charm.plugin.zsh
new file mode 100644
index 000000000..52361ce95
--- /dev/null
+++ b/plugins/charm/charm.plugin.zsh
@@ -0,0 +1,14 @@
+# Autocompletion for the Charm CLI (charm).
+if (( ! $+commands[charm] )); then
+ return
+fi
+
+# If the completion file doesn't exist yet, we need to autoload it and
+# bind it to `charm`. Otherwise, compinit will have already done that.
+if [[ ! -f "$ZSH_CACHE_DIR/completions/_charm" ]]; then
+ typeset -g -A _comps
+ autoload -Uz _charm
+ _comps[charm]=_charm
+fi
+
+charm completion zsh >| "$ZSH_CACHE_DIR/completions/_charm" &|