34d6932b081055901ee95512eae5935a11bb51cd

Author
Lin <56944601+LinPr@users.noreply.github.com>
Committer
GitHub <noreply@github.com>
Date

Message

feat(task): add completion plugin (#13313)

Diff

 1diff --git a/plugins/task/README.md b/plugins/task/README.md
 2new file mode 100644
 3index 0000000000000000000000000000000000000000..606289bcdd9e00b2ae9297902ed7e416646ddaf2
 4--- /dev/null
 5+++ b/plugins/task/README.md
 6@@ -0,0 +1,9 @@
 7+# Buf plugin
 8+
 9+This plugin adds completion for [Task CLI](https://taskfile.dev/), a fast, cross-platform build tool inspired by Make, designed for modern workflows.
10+
11+To use it, add `task` to the plugins array in your zshrc file:
12+
13+```zsh
14+plugins=(... task)
15+```
16diff --git a/plugins/task/task.plugin.zsh b/plugins/task/task.plugin.zsh
17new file mode 100644
18index 0000000000000000000000000000000000000000..86b21b3cd01e9bfcf70d00ff966e5c54fb2227ba
19--- /dev/null
20+++ b/plugins/task/task.plugin.zsh
21@@ -0,0 +1,14 @@
22+# Autocompletion for the task CLI (task).
23+if (( !$+commands[task] )); then
24+  return
25+fi
26+# If the completion file doesn't exist yet, we need to autoload it and
27+# bind it to `task`. Otherwise, compinit will have already done that.
28+if [[ ! -f "$ZSH_CACHE_DIR/completions/_task" ]]; then
29+  typeset -g -A _comps
30+  autoload -Uz _task
31+  _comps[task]=_task
32+fi
33+
34+# Generate and load task completion
35+task --completion zsh >! "$ZSH_CACHE_DIR/completions/_task" &|