diff options
| author | Lin <56944601+LinPr@users.noreply.github.com> | 2024-10-17 16:00:29 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-17 10:00:29 +0200 |
| commit | 8da75e390bbe3b64f01fa643cfab815a20bc48f6 (patch) | |
| tree | 806ddd8341f218f60add9f38e6334671c082f733 /plugins/buf | |
| parent | 1b5af717a987a58deda1873cb28e4b05ba26bba8 (diff) | |
| download | zsh-8da75e390bbe3b64f01fa643cfab815a20bc48f6.tar.gz zsh-8da75e390bbe3b64f01fa643cfab815a20bc48f6.tar.bz2 zsh-8da75e390bbe3b64f01fa643cfab815a20bc48f6.zip | |
feat(buf): add completion plugin
Diffstat (limited to 'plugins/buf')
| -rw-r--r-- | plugins/buf/README.md | 9 | ||||
| -rw-r--r-- | plugins/buf/buf.plugin.zsh | 14 |
2 files changed, 23 insertions, 0 deletions
diff --git a/plugins/buf/README.md b/plugins/buf/README.md new file mode 100644 index 000000000..946cf38dd --- /dev/null +++ b/plugins/buf/README.md @@ -0,0 +1,9 @@ +# Buf plugin + +This plugin adds completion for [Buf CLI](https://github.com/bufbuild/buf), a tool working with Protocol Buffers. + +To use it, add `buf` to the plugins array in your zshrc file: + +```zsh +plugins=(... buf) +```
\ No newline at end of file diff --git a/plugins/buf/buf.plugin.zsh b/plugins/buf/buf.plugin.zsh new file mode 100644 index 000000000..0b251ac37 --- /dev/null +++ b/plugins/buf/buf.plugin.zsh @@ -0,0 +1,14 @@ +# Autocompletion for the Buf CLI (buf). +if (( !$+commands[buf] )); then + return +fi +# If the completion file doesn't exist yet, we need to autoload it and +# bind it to `buf`. Otherwise, compinit will have already done that. +if [[ ! -f "$ZSH_CACHE_DIR/completions/_buf" ]]; then + typeset -g -A _comps + autoload -Uz _buf + _comps[buf]=_buf +fi + +# Generate and load buf completion +buf completion zsh >! "$ZSH_CACHE_DIR/completions/_buf" &|
\ No newline at end of file |
