mirror of
https://github.com/go-task/task.git
synced 2024-12-14 10:52:43 +02:00
c9aec2f281
As task is a very generic name that conflicts with for example taskwarrior, some packagers might choose to change it. See my package in the AUR: https://aur.archlinux.org/packages/go-task. This change makes it easier to configure the name for downstream packagers.
27 lines
536 B
Bash
27 lines
536 B
Bash
#!/bin/bash
|
|
|
|
GO_TASK_PROGNAME=task
|
|
|
|
_go_task_completion()
|
|
{
|
|
local cur
|
|
_get_comp_words_by_ref -n : cur
|
|
|
|
case "$cur" in
|
|
--*)
|
|
local options
|
|
options="$(_parse_help task)"
|
|
mapfile -t COMPREPLY < <(compgen -W "$options" -- "$cur")
|
|
;;
|
|
*)
|
|
local tasks
|
|
tasks="$($GO_TASK_PROGNAME --list-all 2> /dev/null | awk 'NR>1 { sub(/:$/,"",$2); print $2 }')"
|
|
mapfile -t COMPREPLY < <(compgen -W "$tasks" -- "$cur")
|
|
;;
|
|
esac
|
|
|
|
__ltrim_colon_completions "$cur"
|
|
}
|
|
|
|
complete -F _go_task_completion $GO_TASK_PROGNAME
|