mirror of
https://github.com/go-task/task.git
synced 2025-01-12 04:34:11 +02:00
* Use --silent to get list of tasks
This commit is contained in:
parent
3cc378c960
commit
6a3cc79daa
@ -32,16 +32,11 @@ function _task()
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Get task names.
|
# Prepare task name completions.
|
||||||
local line tasks=()
|
local tasks=( $( "${COMP_WORDS[@]}" --silent $_GO_TASK_COMPLETION_LIST_OPTION 2> /dev/null ) )
|
||||||
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.
|
|
||||||
COMPREPLY=( $( compgen -W "${tasks[*]}" -- "$cur" ) )
|
COMPREPLY=( $( compgen -W "${tasks[*]}" -- "$cur" ) )
|
||||||
|
|
||||||
|
# Post-process because task names might contain colons.
|
||||||
__ltrim_colon_completions "$cur"
|
__ltrim_colon_completions "$cur"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user