2022-05-22 16:15:15 +02:00
|
|
|
#!/bin/bash
|
2022-02-13 21:20:01 +02:00
|
|
|
|
2019-08-30 01:59:03 +02:00
|
|
|
_task_completion()
|
|
|
|
{
|
2022-02-13 21:20:01 +02:00
|
|
|
local cur
|
|
|
|
_get_comp_words_by_ref -n : cur
|
2019-08-30 01:59:03 +02:00
|
|
|
|
2022-02-13 21:20:01 +02:00
|
|
|
case "$cur" in
|
|
|
|
--*)
|
2022-05-22 16:15:15 +02:00
|
|
|
local options
|
|
|
|
options="$(_parse_help task)"
|
|
|
|
mapfile -t COMPREPLY < <(compgen -W "$options" -- "$cur")
|
2022-02-13 21:20:01 +02:00
|
|
|
;;
|
|
|
|
*)
|
2022-05-22 16:15:15 +02:00
|
|
|
local tasks
|
|
|
|
tasks="$(task --list-all | awk 'NR>1 { sub(/:$/,"",$2); print $2 }')"
|
|
|
|
mapfile -t COMPREPLY < <(compgen -W "$tasks" -- "$cur")
|
2022-02-13 21:20:01 +02:00
|
|
|
;;
|
|
|
|
esac
|
2019-08-30 01:59:03 +02:00
|
|
|
|
2022-02-13 21:20:01 +02:00
|
|
|
__ltrim_colon_completions "$cur"
|
2019-08-30 01:59:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
complete -F _task_completion task
|