mirror of
https://github.com/go-task/task.git
synced 2025-02-01 13:17:56 +02:00
fix: fix CLI_ARGS completion for fish and zsh (#1843)
This commit is contained in:
parent
ad5a3166ac
commit
69906b50fe
@ -16,8 +16,10 @@ function __task_get_tasks --description "Prints all available tasks with their d
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
complete -c $GO_TASK_PROGNAME -d 'Runs the specified task(s). Falls back to the "default" task if no task name was specified, or lists all tasks if an unknown task name was
|
complete -c $GO_TASK_PROGNAME \
|
||||||
specified.' -xa "(__task_get_tasks)"
|
-d 'Runs the specified task(s). Falls back to the "default" task if no task name was specified, or lists all tasks if an unknown task name was specified.' \
|
||||||
|
-xa "(__task_get_tasks)" \
|
||||||
|
-n "not __fish_seen_subcommand_from --"
|
||||||
|
|
||||||
complete -c $GO_TASK_PROGNAME -s c -l color -d 'colored output (default true)'
|
complete -c $GO_TASK_PROGNAME -s c -l color -d 'colored output (default true)'
|
||||||
complete -c $GO_TASK_PROGNAME -s d -l dir -d 'sets directory of execution'
|
complete -c $GO_TASK_PROGNAME -s d -l dir -d 'sets directory of execution'
|
||||||
|
@ -14,6 +14,13 @@ function __task_list() {
|
|||||||
taskfile=${(Qv)opt_args[(i)-t|--taskfile]}
|
taskfile=${(Qv)opt_args[(i)-t|--taskfile]}
|
||||||
taskfile=${taskfile//\~/$HOME}
|
taskfile=${taskfile//\~/$HOME}
|
||||||
|
|
||||||
|
for arg in "${words[@]:0:$CURRENT}"; do
|
||||||
|
if [[ "$arg" = "--" ]]; then
|
||||||
|
# Use default completion for words after `--` as they are CLI_ARGS.
|
||||||
|
_default
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
if [[ -n "$taskfile" && -f "$taskfile" ]]; then
|
if [[ -n "$taskfile" && -f "$taskfile" ]]; then
|
||||||
enabled=1
|
enabled=1
|
||||||
@ -40,6 +47,7 @@ function __task_list() {
|
|||||||
|
|
||||||
_task() {
|
_task() {
|
||||||
_arguments \
|
_arguments \
|
||||||
|
-S \
|
||||||
'(-C --concurrency)'{-C,--concurrency}'[limit number of concurrent tasks]: ' \
|
'(-C --concurrency)'{-C,--concurrency}'[limit number of concurrent tasks]: ' \
|
||||||
'(-p --parallel)'{-p,--parallel}'[run command-line tasks in parallel]' \
|
'(-p --parallel)'{-p,--parallel}'[run command-line tasks in parallel]' \
|
||||||
'(-f --force)'{-f,--force}'[run even if task is up-to-date]' \
|
'(-f --force)'{-f,--force}'[run even if task is up-to-date]' \
|
||||||
@ -55,13 +63,13 @@ _task() {
|
|||||||
'(-t --taskfile)'{-t,--taskfile}'[specify a different taskfile]:taskfile:_files' \
|
'(-t --taskfile)'{-t,--taskfile}'[specify a different taskfile]:taskfile:_files' \
|
||||||
'(-v --verbose)'{-v,--verbose}'[verbose mode]' \
|
'(-v --verbose)'{-v,--verbose}'[verbose mode]' \
|
||||||
'(-w --watch)'{-w,--watch}'[watch-mode for given tasks, re-run when inputs change]' \
|
'(-w --watch)'{-w,--watch}'[watch-mode for given tasks, re-run when inputs change]' \
|
||||||
|
'(operation)*: :__task_list' \
|
||||||
+ '(operation)' \
|
+ '(operation)' \
|
||||||
{-l,--list}'[list describable tasks]' \
|
'(*)'{-l,--list}'[list describable tasks]' \
|
||||||
{-a,--list-all}'[list all tasks]' \
|
'(*)'{-a,--list-all}'[list all tasks]' \
|
||||||
{-i,--init}'[create new Taskfile.yml]' \
|
'(*)'{-i,--init}'[create new Taskfile.yml]' \
|
||||||
'(-*)'{-h,--help}'[show help]' \
|
'(- *)'{-h,--help}'[show help]' \
|
||||||
'(-*)--version[show version and exit]' \
|
'(- *)--version[show version and exit]' \
|
||||||
'*: :__task_list'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# don't run the completion function when being source-ed or eval-ed
|
# don't run the completion function when being source-ed or eval-ed
|
||||||
|
Loading…
x
Reference in New Issue
Block a user