1b9d6e5c82cab11ad58eb43988d4e5a256dabdc6

Author
Matheus Pimenta <matheuscscp@gmail.com>
Committer
GitHub <noreply@github.com>
Date

Message

feat(timoni): add completion plugin (#12802)

Diff

 1diff --git a/plugins/timoni/README.md b/plugins/timoni/README.md
 2new file mode 100644
 3index 0000000000000000000000000000000000000000..8701ede48c3b32710016c46104a3f2bf7ec3d68d
 4--- /dev/null
 5+++ b/plugins/timoni/README.md
 6@@ -0,0 +1,9 @@
 7+# Timoni plugin
 8+
 9+This plugin adds completion for [Timoni](https://timoni.sh), a package manager for Kubernetes, powered by CUE and inspired by Helm.
10+
11+To use it, add `timoni` to the plugins array in your zshrc file:
12+
13+```zsh
14+plugins=(... timoni)
15+```
16diff --git a/plugins/timoni/timoni.plugin.zsh b/plugins/timoni/timoni.plugin.zsh
17new file mode 100644
18index 0000000000000000000000000000000000000000..971eda0b4b113024a6c20598e82e242b7bd6ac31
19--- /dev/null
20+++ b/plugins/timoni/timoni.plugin.zsh
21@@ -0,0 +1,14 @@
22+# Autocompletion for the Timoni CLI (timoni).
23+if (( ! $+commands[timoni] )); then
24+  return
25+fi
26+
27+# If the completion file doesn't exist yet, we need to autoload it and
28+# bind it to `timoni`. Otherwise, compinit will have already done that.
29+if [[ ! -f "$ZSH_CACHE_DIR/completions/_timoni" ]]; then
30+  typeset -g -A _comps
31+  autoload -Uz _timoni
32+  _comps[timoni]=_timoni
33+fi
34+
35+timoni completion zsh >| "$ZSH_CACHE_DIR/completions/_timoni" &|