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

* Convert indentation to 2 spaces

This commit is contained in:
Mario Schwalbe
2022-08-13 21:55:35 +02:00
parent d048555149
commit 3cc378c960

View File

@ -1,48 +1,48 @@
# vim: set tabstop=4 shiftwidth=4 expandtab: # vim: set tabstop=2 shiftwidth=2 expandtab:
_GO_TASK_COMPLETION_LIST_OPTION='--list-all' _GO_TASK_COMPLETION_LIST_OPTION='--list-all'
function _task() function _task()
{ {
local cur prev words cword local cur prev words cword
_init_completion -n : || return _init_completion -n : || return
# Handle special arguments of options. # Handle special arguments of options.
case "$prev" in case "$prev" in
-d|--dir) -d|--dir)
_filedir -d _filedir -d
return $? return $?
;; ;;
-t|--taskfile) -t|--taskfile)
_filedir yaml _filedir yaml || return $?
_filedir yml _filedir yml
return $? return $?
;; ;;
-o|--output) -o|--output)
COMPREPLY=( $( compgen -W "interleaved group prefixed" -- $cur ) ) COMPREPLY=( $( compgen -W "interleaved group prefixed" -- $cur ) )
return 0 return 0
;; ;;
esac esac
# Handle normal options. # Handle normal options.
case "$cur" in case "$cur" in
-*) -*)
COMPREPLY=( $( compgen -W "$(_parse_help $1)" -- $cur ) ) COMPREPLY=( $( compgen -W "$(_parse_help $1)" -- $cur ) )
return 0 return 0
;; ;;
esac esac
# Get task names. # Get task names.
local line tasks=() local line tasks=()
while read line; do while read line; do
if [[ "${line}" =~ ^\*[[:space:]]+([[:alnum:]_:]+): ]]; then if [[ "${line}" =~ ^\*[[:space:]]+([[:alnum:]_:]+): ]]; then
tasks+=( ${BASH_REMATCH[1]} ) tasks+=( ${BASH_REMATCH[1]} )
fi fi
done < <("${COMP_WORDS[@]}" $_GO_TASK_COMPLETION_LIST_OPTION 2> /dev/null) done < <("${COMP_WORDS[@]}" $_GO_TASK_COMPLETION_LIST_OPTION 2> /dev/null)
# Prepare task completions and post-process due to colons. # Prepare task completions and post-process due to colons.
COMPREPLY=( $( compgen -W "${tasks[*]}" -- "$cur" ) ) COMPREPLY=( $( compgen -W "${tasks[*]}" -- "$cur" ) )
__ltrim_colon_completions "$cur" __ltrim_colon_completions "$cur"
} }
complete -F _task task complete -F _task task