d6658f9af321e615a9b8be696f557a113cd6b026

Author
Eric Schultz <eric@wwahammy.com>
Committer
GitHub <noreply@github.com>
Date

Message

feat(stripe): add completion plugin (#12064)

Co-authored-by: Carlo Sala <carlosalag@protonmail.com>

Diff

 1diff --git a/plugins/stripe/README.md b/plugins/stripe/README.md
 2new file mode 100644
 3index 0000000000000000000000000000000000000000..9f0f32bc2bcd2e781a4cc9cf2773004e8f054b02
 4--- /dev/null
 5+++ b/plugins/stripe/README.md
 6@@ -0,0 +1,9 @@
 7+# Struoe
 8+
 9+This plugin provides completion for the [Stripe CLI](https://stripe.com/docs/stripe-cli).
10+
11+To use it add stripe to the plugins array in your zshrc file.
12+
13+```bash
14+plugins=(... stripe)
15+```
16diff --git a/plugins/stripe/stripe.plugin.zsh b/plugins/stripe/stripe.plugin.zsh
17new file mode 100644
18index 0000000000000000000000000000000000000000..e2041bef2f12bc0d4d1c02390175c2d2b721cd4e
19--- /dev/null
20+++ b/plugins/stripe/stripe.plugin.zsh
21@@ -0,0 +1,13 @@
22+if (( ! $+commands[stripe] )); then
23+  return
24+fi
25+
26+# If the completion file doesn't exist yet, we need to autoload it and
27+# bind it to `stripe`. Otherwise, compinit will have already done that.
28+if [[ ! -f "$ZSH_CACHE_DIR/completions/_stripe" ]]; then
29+  typeset -g -A _comps
30+  autoload -Uz _stripe
31+  _comps[stripe]=_stripe
32+fi
33+
34+stripe completion --shell zsh --write-to-stdout >| "$ZSH_CACHE_DIR/completions/_stripe" &|