summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorMark Mercado <mmercado@digitalocean.com>2022-03-29 05:45:20 -0400
committerGitHub <noreply@github.com>2022-03-29 11:45:20 +0200
commitd77ac9e29d6079a7ecd561417772c3218aac94b1 (patch)
treeebb6f13a28bd10ddd0662ed43e71e20590dfbf84 /plugins
parent9e967b4eccbe26701315860a3b0bad01fde725c8 (diff)
downloadzsh-d77ac9e29d6079a7ecd561417772c3218aac94b1.tar.gz
zsh-d77ac9e29d6079a7ecd561417772c3218aac94b1.tar.bz2
zsh-d77ac9e29d6079a7ecd561417772c3218aac94b1.zip
feat(charm): add plugin for `charm` (#10803)
Diffstat (limited to 'plugins')
-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" &|