1
0
mirror of https://github.com/go-task/task.git synced 2025-01-24 05:17:21 +02:00

Merge pull request from MarioSchwalbe/bash-completion

Use --silent to get the list of tasks (bash completion)
This commit is contained in:
Andrey Nering 2022-08-23 18:39:47 -03:00 committed by GitHub
commit 73eaa68cd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -32,16 +32,11 @@ function _task()
;;
esac
# Get task names.
local line tasks=()
while read line; do
if [[ "${line}" =~ ^\*[[:space:]]+([[:alnum:]_:]+): ]]; then
tasks+=( ${BASH_REMATCH[1]} )
fi
done < <("${COMP_WORDS[@]}" $_GO_TASK_COMPLETION_LIST_OPTION 2> /dev/null)
# Prepare task completions and post-process due to colons.
# Prepare task name completions.
local tasks=( $( "${COMP_WORDS[@]}" --silent $_GO_TASK_COMPLETION_LIST_OPTION 2> /dev/null ) )
COMPREPLY=( $( compgen -W "${tasks[*]}" -- "$cur" ) )
# Post-process because task names might contain colons.
__ltrim_colon_completions "$cur"
}