From c9aec2f281a8fb63a193de2f8f0018ab797ddd5b Mon Sep 17 00:00:00 2001 From: Carl Smedstad Date: Sun, 22 May 2022 16:16:50 +0200 Subject: [PATCH] Make progname easier to configure in task.bash 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. --- completion/bash/task.bash | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/completion/bash/task.bash b/completion/bash/task.bash index f70a5758..46e3a452 100644 --- a/completion/bash/task.bash +++ b/completion/bash/task.bash @@ -1,6 +1,8 @@ #!/bin/bash -_task_completion() +GO_TASK_PROGNAME=task + +_go_task_completion() { local cur _get_comp_words_by_ref -n : cur @@ -13,7 +15,7 @@ _task_completion() ;; *) local tasks - tasks="$(task --list-all | awk 'NR>1 { sub(/:$/,"",$2); print $2 }')" + tasks="$($GO_TASK_PROGNAME --list-all 2> /dev/null | awk 'NR>1 { sub(/:$/,"",$2); print $2 }')" mapfile -t COMPREPLY < <(compgen -W "$tasks" -- "$cur") ;; esac @@ -21,4 +23,4 @@ _task_completion() __ltrim_colon_completions "$cur" } -complete -F _task_completion task +complete -F _go_task_completion $GO_TASK_PROGNAME