|
1 | 1 | #compdef task |
2 | | - |
3 | | -local context state state_descr line |
| 2 | +compdef _task task |
4 | 3 | typeset -A opt_args |
5 | 4 |
|
6 | 5 | _GO_TASK_COMPLETION_LIST_OPTION="${GO_TASK_COMPLETION_LIST_OPTION:---list-all}" |
@@ -39,26 +38,33 @@ function __task_list() { |
39 | 38 | _describe 'Task to run' scripts |
40 | 39 | } |
41 | 40 |
|
42 | | -_arguments \ |
43 | | - '(-C --concurrency)'{-C,--concurrency}'[limit number of concurrent tasks]: ' \ |
44 | | - '(-p --parallel)'{-p,--parallel}'[run command-line tasks in parallel]' \ |
45 | | - '(-f --force)'{-f,--force}'[run even if task is up-to-date]' \ |
46 | | - '(-c --color)'{-c,--color}'[colored output]' \ |
47 | | - '(-d --dir)'{-d,--dir}'[dir to run in]:execution dir:_dirs' \ |
48 | | - '(--dry)--dry[dry-run mode, compile and print tasks only]' \ |
49 | | - '(-o --output)'{-o,--output}'[set output style]:style:(interleaved group prefixed)' \ |
50 | | - '(--output-group-begin)--output-group-begin[message template before grouped output]:template text: ' \ |
51 | | - '(--output-group-end)--output-group-end[message template after grouped output]:template text: ' \ |
52 | | - '(-s --silent)'{-s,--silent}'[disable echoing]' \ |
53 | | - '(--status)--status[exit non-zero if supplied tasks not up-to-date]' \ |
54 | | - '(--summary)--summary[show summary\: field from tasks instead of running them]' \ |
55 | | - '(-t --taskfile)'{-t,--taskfile}'[specify a different taskfile]:taskfile:_files' \ |
56 | | - '(-v --verbose)'{-v,--verbose}'[verbose mode]' \ |
57 | | - '(-w --watch)'{-w,--watch}'[watch-mode for given tasks, re-run when inputs change]' \ |
58 | | - + '(operation)' \ |
59 | | - {-l,--list}'[list describable tasks]' \ |
60 | | - {-a,--list-all}'[list all tasks]' \ |
61 | | - {-i,--init}'[create new Taskfile.yml]' \ |
62 | | - '(-*)'{-h,--help}'[show help]' \ |
63 | | - '(-*)--version[show version and exit]' \ |
64 | | - '*: :__task_list' |
| 41 | +_task() { |
| 42 | + _arguments \ |
| 43 | + '(-C --concurrency)'{-C,--concurrency}'[limit number of concurrent tasks]: ' \ |
| 44 | + '(-p --parallel)'{-p,--parallel}'[run command-line tasks in parallel]' \ |
| 45 | + '(-f --force)'{-f,--force}'[run even if task is up-to-date]' \ |
| 46 | + '(-c --color)'{-c,--color}'[colored output]' \ |
| 47 | + '(-d --dir)'{-d,--dir}'[dir to run in]:execution dir:_dirs' \ |
| 48 | + '(--dry)--dry[dry-run mode, compile and print tasks only]' \ |
| 49 | + '(-o --output)'{-o,--output}'[set output style]:style:(interleaved group prefixed)' \ |
| 50 | + '(--output-group-begin)--output-group-begin[message template before grouped output]:template text: ' \ |
| 51 | + '(--output-group-end)--output-group-end[message template after grouped output]:template text: ' \ |
| 52 | + '(-s --silent)'{-s,--silent}'[disable echoing]' \ |
| 53 | + '(--status)--status[exit non-zero if supplied tasks not up-to-date]' \ |
| 54 | + '(--summary)--summary[show summary\: field from tasks instead of running them]' \ |
| 55 | + '(-t --taskfile)'{-t,--taskfile}'[specify a different taskfile]:taskfile:_files' \ |
| 56 | + '(-v --verbose)'{-v,--verbose}'[verbose mode]' \ |
| 57 | + '(-w --watch)'{-w,--watch}'[watch-mode for given tasks, re-run when inputs change]' \ |
| 58 | + + '(operation)' \ |
| 59 | + {-l,--list}'[list describable tasks]' \ |
| 60 | + {-a,--list-all}'[list all tasks]' \ |
| 61 | + {-i,--init}'[create new Taskfile.yml]' \ |
| 62 | + '(-*)'{-h,--help}'[show help]' \ |
| 63 | + '(-*)--version[show version and exit]' \ |
| 64 | + '*: :__task_list' |
| 65 | +} |
| 66 | + |
| 67 | +# don't run the completion function when being source-ed or eval-ed |
| 68 | +if [ "$funcstack[1]" = "_task" ]; then |
| 69 | + _task "$@" |
| 70 | +fi |
0 commit comments