Skip to content

Commit 1c86066

Browse files
committed
wip
1 parent 7901cce commit 1c86066

File tree

3 files changed

+128
-30
lines changed

3 files changed

+128
-30
lines changed

completion/fish/task.fish

Lines changed: 43 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,46 @@ end
3636
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
3737
specified.' -xa "(__task_get_tasks)"
3838

39-
complete -c $GO_TASK_PROGNAME -s c -l color -d 'colored output (default true)'
40-
complete -c $GO_TASK_PROGNAME -s d -l dir -d 'sets directory of execution'
41-
complete -c $GO_TASK_PROGNAME -l dry -d 'compiles and prints tasks in the order that they would be run, without executing them'
42-
complete -c $GO_TASK_PROGNAME -s f -l force -d 'forces execution even when the task is up-to-date'
43-
complete -c $GO_TASK_PROGNAME -s h -l help -d 'shows Task usage'
44-
complete -c $GO_TASK_PROGNAME -s i -l init -d 'creates a new Taskfile.yml in the current folder'
45-
complete -c $GO_TASK_PROGNAME -s l -l list -d 'lists tasks with description of current Taskfile'
46-
complete -c $GO_TASK_PROGNAME -s o -l output -d 'sets output style: [interleaved|group|prefixed]' -xa "interleaved group prefixed"
47-
complete -c $GO_TASK_PROGNAME -s p -l parallel -d 'executes tasks provided on command line in parallel'
48-
complete -c $GO_TASK_PROGNAME -s s -l silent -d 'disables echoing'
49-
complete -c $GO_TASK_PROGNAME -l status -d 'exits with non-zero exit code if any of the given tasks is not up-to-date'
50-
complete -c $GO_TASK_PROGNAME -l summary -d 'show summary about a task'
51-
complete -c $GO_TASK_PROGNAME -s t -l taskfile -d 'choose which Taskfile to run. Defaults to "Taskfile.yml"'
52-
complete -c $GO_TASK_PROGNAME -s v -l verbose -d 'enables verbose mode'
53-
complete -c $GO_TASK_PROGNAME -l version -d 'show Task version'
54-
complete -c $GO_TASK_PROGNAME -s w -l watch -d 'enables watch of the given task'
39+
# Standard flags
40+
complete -c $GO_TASK_PROGNAME -s a -l list-all -d 'list all tasks'
41+
complete -c $GO_TASK_PROGNAME -s c -l color -d 'colored output (default true)'
42+
complete -c $GO_TASK_PROGNAME -s C -l concurrency -d 'limit number of concurrent tasks'
43+
complete -c $GO_TASK_PROGNAME -l completion -d 'generate shell completion script' -xa "bash zsh fish powershell"
44+
complete -c $GO_TASK_PROGNAME -s d -l dir -d 'set directory of execution'
45+
complete -c $GO_TASK_PROGNAME -s n -l dry -d 'compile and print tasks without executing'
46+
complete -c $GO_TASK_PROGNAME -s x -l exit-code -d 'pass-through exit code of task command'
47+
complete -c $GO_TASK_PROGNAME -l experiments -d 'list available experiments'
48+
complete -c $GO_TASK_PROGNAME -s f -l force -d 'force execution even when up-to-date'
49+
complete -c $GO_TASK_PROGNAME -s g -l global -d 'run global Taskfile from home directory'
50+
complete -c $GO_TASK_PROGNAME -s h -l help -d 'show help'
51+
complete -c $GO_TASK_PROGNAME -s i -l init -d 'create new Taskfile'
52+
complete -c $GO_TASK_PROGNAME -l insecure -d 'allow insecure Taskfile downloads'
53+
complete -c $GO_TASK_PROGNAME -s I -l interval -d 'interval to watch for changes'
54+
complete -c $GO_TASK_PROGNAME -s j -l json -d 'format task list as JSON'
55+
complete -c $GO_TASK_PROGNAME -s l -l list -d 'list tasks with descriptions'
56+
complete -c $GO_TASK_PROGNAME -l nested -d 'nest namespaces when listing as JSON'
57+
complete -c $GO_TASK_PROGNAME -l no-status -d 'ignore status when listing as JSON'
58+
complete -c $GO_TASK_PROGNAME -s o -l output -d 'set output style' -xa "interleaved group prefixed"
59+
complete -c $GO_TASK_PROGNAME -l output-group-begin -d 'message template before grouped output'
60+
complete -c $GO_TASK_PROGNAME -l output-group-end -d 'message template after grouped output'
61+
complete -c $GO_TASK_PROGNAME -l output-group-error-only -d 'hide output from successful tasks'
62+
complete -c $GO_TASK_PROGNAME -s p -l parallel -d 'execute tasks in parallel'
63+
complete -c $GO_TASK_PROGNAME -s s -l silent -d 'disable echoing'
64+
complete -c $GO_TASK_PROGNAME -l sort -d 'set task sorting order' -xa "default alphanumeric none"
65+
complete -c $GO_TASK_PROGNAME -l status -d 'exit non-zero if tasks not up-to-date'
66+
complete -c $GO_TASK_PROGNAME -l summary -d 'show task summary'
67+
complete -c $GO_TASK_PROGNAME -s t -l taskfile -d 'choose Taskfile to run'
68+
complete -c $GO_TASK_PROGNAME -s v -l verbose -d 'verbose output'
69+
complete -c $GO_TASK_PROGNAME -l version -d 'show version'
70+
complete -c $GO_TASK_PROGNAME -s w -l watch -d 'watch mode, re-run on changes'
71+
complete -c $GO_TASK_PROGNAME -s y -l yes -d 'assume yes to all prompts'
72+
73+
# Experimental flags (require experiments to be enabled)
74+
# GentleForce experiment:
75+
# complete -c $GO_TASK_PROGNAME -l force-all -d 'force execution of task and all dependencies'
76+
# RemoteTaskfiles experiment:
77+
# complete -c $GO_TASK_PROGNAME -l download -d 'download remote Taskfile'
78+
# complete -c $GO_TASK_PROGNAME -l offline -d 'use only local or cached Taskfiles'
79+
# complete -c $GO_TASK_PROGNAME -l timeout -d 'timeout for remote Taskfile downloads'
80+
# complete -c $GO_TASK_PROGNAME -l clear-cache -d 'clear remote Taskfile cache'
81+
# complete -c $GO_TASK_PROGNAME -l expiry -d 'cache expiry duration'

completion/ps/task.ps1

Lines changed: 63 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,69 @@ Register-ArgumentCompleter -CommandName task -ScriptBlock {
55

66
if ($commandName.StartsWith('-')) {
77
$completions = @(
8-
[CompletionResult]::new('--list-all ', '--list-all ', [CompletionResultType]::ParameterName, 'list all tasks'),
9-
[CompletionResult]::new('--color ', '--color', [CompletionResultType]::ParameterName, '--color'),
10-
[CompletionResult]::new('--concurrency=', '--concurrency=', [CompletionResultType]::ParameterName, 'concurrency'),
11-
[CompletionResult]::new('--interval=', '--interval=', [CompletionResultType]::ParameterName, 'interval'),
12-
[CompletionResult]::new('--output=interleaved ', '--output=interleaved', [CompletionResultType]::ParameterName, '--output='),
13-
[CompletionResult]::new('--output=group ', '--output=group', [CompletionResultType]::ParameterName, '--output='),
14-
[CompletionResult]::new('--output=prefixed ', '--output=prefixed', [CompletionResultType]::ParameterName, '--output='),
15-
[CompletionResult]::new('--dry ', '--dry', [CompletionResultType]::ParameterName, '--dry'),
16-
[CompletionResult]::new('--force ', '--force', [CompletionResultType]::ParameterName, '--force'),
17-
[CompletionResult]::new('--parallel ', '--parallel', [CompletionResultType]::ParameterName, '--parallel'),
18-
[CompletionResult]::new('--silent ', '--silent', [CompletionResultType]::ParameterName, '--silent'),
19-
[CompletionResult]::new('--status ', '--status', [CompletionResultType]::ParameterName, '--status'),
20-
[CompletionResult]::new('--verbose ', '--verbose', [CompletionResultType]::ParameterName, '--verbose'),
21-
[CompletionResult]::new('--watch ', '--watch', [CompletionResultType]::ParameterName, '--watch')
8+
# Standard flags (alphabetical order)
9+
[CompletionResult]::new('-a', '-a', [CompletionResultType]::ParameterName, 'list all tasks'),
10+
[CompletionResult]::new('--list-all', '--list-all', [CompletionResultType]::ParameterName, 'list all tasks'),
11+
[CompletionResult]::new('-c', '-c', [CompletionResultType]::ParameterName, 'colored output'),
12+
[CompletionResult]::new('--color', '--color', [CompletionResultType]::ParameterName, 'colored output'),
13+
[CompletionResult]::new('-C', '-C', [CompletionResultType]::ParameterName, 'limit concurrent tasks'),
14+
[CompletionResult]::new('--concurrency', '--concurrency', [CompletionResultType]::ParameterName, 'limit concurrent tasks'),
15+
[CompletionResult]::new('--completion', '--completion', [CompletionResultType]::ParameterName, 'generate shell completion'),
16+
[CompletionResult]::new('-d', '-d', [CompletionResultType]::ParameterName, 'set directory'),
17+
[CompletionResult]::new('--dir', '--dir', [CompletionResultType]::ParameterName, 'set directory'),
18+
[CompletionResult]::new('-n', '-n', [CompletionResultType]::ParameterName, 'dry run'),
19+
[CompletionResult]::new('--dry', '--dry', [CompletionResultType]::ParameterName, 'dry run'),
20+
[CompletionResult]::new('-x', '-x', [CompletionResultType]::ParameterName, 'pass-through exit code'),
21+
[CompletionResult]::new('--exit-code', '--exit-code', [CompletionResultType]::ParameterName, 'pass-through exit code'),
22+
[CompletionResult]::new('--experiments', '--experiments', [CompletionResultType]::ParameterName, 'list experiments'),
23+
[CompletionResult]::new('-f', '-f', [CompletionResultType]::ParameterName, 'force execution'),
24+
[CompletionResult]::new('--force', '--force', [CompletionResultType]::ParameterName, 'force execution'),
25+
[CompletionResult]::new('-g', '-g', [CompletionResultType]::ParameterName, 'run global Taskfile'),
26+
[CompletionResult]::new('--global', '--global', [CompletionResultType]::ParameterName, 'run global Taskfile'),
27+
[CompletionResult]::new('-h', '-h', [CompletionResultType]::ParameterName, 'show help'),
28+
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, 'show help'),
29+
[CompletionResult]::new('-i', '-i', [CompletionResultType]::ParameterName, 'create new Taskfile'),
30+
[CompletionResult]::new('--init', '--init', [CompletionResultType]::ParameterName, 'create new Taskfile'),
31+
[CompletionResult]::new('--insecure', '--insecure', [CompletionResultType]::ParameterName, 'allow insecure downloads'),
32+
[CompletionResult]::new('-I', '-I', [CompletionResultType]::ParameterName, 'watch interval'),
33+
[CompletionResult]::new('--interval', '--interval', [CompletionResultType]::ParameterName, 'watch interval'),
34+
[CompletionResult]::new('-j', '-j', [CompletionResultType]::ParameterName, 'format as JSON'),
35+
[CompletionResult]::new('--json', '--json', [CompletionResultType]::ParameterName, 'format as JSON'),
36+
[CompletionResult]::new('-l', '-l', [CompletionResultType]::ParameterName, 'list tasks'),
37+
[CompletionResult]::new('--list', '--list', [CompletionResultType]::ParameterName, 'list tasks'),
38+
[CompletionResult]::new('--nested', '--nested', [CompletionResultType]::ParameterName, 'nest namespaces in JSON'),
39+
[CompletionResult]::new('--no-status', '--no-status', [CompletionResultType]::ParameterName, 'ignore status in JSON'),
40+
[CompletionResult]::new('-o', '-o', [CompletionResultType]::ParameterName, 'set output style'),
41+
[CompletionResult]::new('--output', '--output', [CompletionResultType]::ParameterName, 'set output style'),
42+
[CompletionResult]::new('--output-group-begin', '--output-group-begin', [CompletionResultType]::ParameterName, 'template before group'),
43+
[CompletionResult]::new('--output-group-end', '--output-group-end', [CompletionResultType]::ParameterName, 'template after group'),
44+
[CompletionResult]::new('--output-group-error-only', '--output-group-error-only', [CompletionResultType]::ParameterName, 'hide successful output'),
45+
[CompletionResult]::new('-p', '-p', [CompletionResultType]::ParameterName, 'execute in parallel'),
46+
[CompletionResult]::new('--parallel', '--parallel', [CompletionResultType]::ParameterName, 'execute in parallel'),
47+
[CompletionResult]::new('-s', '-s', [CompletionResultType]::ParameterName, 'silent mode'),
48+
[CompletionResult]::new('--silent', '--silent', [CompletionResultType]::ParameterName, 'silent mode'),
49+
[CompletionResult]::new('--sort', '--sort', [CompletionResultType]::ParameterName, 'task sorting order'),
50+
[CompletionResult]::new('--status', '--status', [CompletionResultType]::ParameterName, 'check task status'),
51+
[CompletionResult]::new('--summary', '--summary', [CompletionResultType]::ParameterName, 'show task summary'),
52+
[CompletionResult]::new('-t', '-t', [CompletionResultType]::ParameterName, 'choose Taskfile'),
53+
[CompletionResult]::new('--taskfile', '--taskfile', [CompletionResultType]::ParameterName, 'choose Taskfile'),
54+
[CompletionResult]::new('-v', '-v', [CompletionResultType]::ParameterName, 'verbose output'),
55+
[CompletionResult]::new('--verbose', '--verbose', [CompletionResultType]::ParameterName, 'verbose output'),
56+
[CompletionResult]::new('--version', '--version', [CompletionResultType]::ParameterName, 'show version'),
57+
[CompletionResult]::new('-w', '-w', [CompletionResultType]::ParameterName, 'watch mode'),
58+
[CompletionResult]::new('--watch', '--watch', [CompletionResultType]::ParameterName, 'watch mode'),
59+
[CompletionResult]::new('-y', '-y', [CompletionResultType]::ParameterName, 'assume yes'),
60+
[CompletionResult]::new('--yes', '--yes', [CompletionResultType]::ParameterName, 'assume yes')
61+
62+
# Experimental flags (uncomment when using experiments)
63+
# GentleForce experiment:
64+
# [CompletionResult]::new('--force-all', '--force-all', [CompletionResultType]::ParameterName, 'force all dependencies'),
65+
# RemoteTaskfiles experiment:
66+
# [CompletionResult]::new('--download', '--download', [CompletionResultType]::ParameterName, 'download remote Taskfile'),
67+
# [CompletionResult]::new('--offline', '--offline', [CompletionResultType]::ParameterName, 'use cached Taskfiles'),
68+
# [CompletionResult]::new('--timeout', '--timeout', [CompletionResultType]::ParameterName, 'download timeout'),
69+
# [CompletionResult]::new('--clear-cache', '--clear-cache', [CompletionResultType]::ParameterName, 'clear cache'),
70+
# [CompletionResult]::new('--expiry', '--expiry', [CompletionResultType]::ParameterName, 'cache expiry')
2271
)
2372

2473
return $completions.Where{ $_.CompletionText.StartsWith($commandName) }

completion/zsh/_task

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,24 +41,46 @@ _task() {
4141
'(-p --parallel)'{-p,--parallel}'[run command-line tasks in parallel]' \
4242
'(-f --force)'{-f,--force}'[run even if task is up-to-date]' \
4343
'(-c --color)'{-c,--color}'[colored output]' \
44+
'(--completion)--completion[generate shell completion script]:shell:(bash zsh fish powershell)' \
4445
'(-d --dir)'{-d,--dir}'[dir to run in]:execution dir:_dirs' \
46+
'(-n --dry)'{-n,--dry}'[compiles and prints tasks without executing]' \
4547
'(--dry)--dry[dry-run mode, compile and print tasks only]' \
48+
'(-x --exit-code)'{-x,--exit-code}'[pass-through exit code of task command]' \
49+
'(--experiments)--experiments[list available experiments]' \
50+
'(-g --global)'{-g,--global}'[run global Taskfile from home directory]' \
51+
'(--insecure)--insecure[allow insecure Taskfile downloads]' \
52+
'(-I --interval)'{-I,--interval}'[interval to watch for changes]:duration: ' \
53+
'(-j --json)'{-j,--json}'[format task list as JSON]' \
54+
'(--nested)--nested[nest namespaces when listing as JSON]' \
55+
'(--no-status)--no-status[ignore status when listing as JSON]' \
4656
'(-o --output)'{-o,--output}'[set output style]:style:(interleaved group prefixed)' \
4757
'(--output-group-begin)--output-group-begin[message template before grouped output]:template text: ' \
4858
'(--output-group-end)--output-group-end[message template after grouped output]:template text: ' \
59+
'(--output-group-error-only)--output-group-error-only[hide output from successful tasks]' \
4960
'(-s --silent)'{-s,--silent}'[disable echoing]' \
61+
'(--sort)--sort[set task sorting order]:order:(default alphanumeric none)' \
5062
'(--status)--status[exit non-zero if supplied tasks not up-to-date]' \
5163
'(--summary)--summary[show summary\: field from tasks instead of running them]' \
5264
'(-t --taskfile)'{-t,--taskfile}'[specify a different taskfile]:taskfile:_files' \
5365
'(-v --verbose)'{-v,--verbose}'[verbose mode]' \
5466
'(-w --watch)'{-w,--watch}'[watch-mode for given tasks, re-run when inputs change]' \
67+
'(-y --yes)'{-y,--yes}'[assume yes to all prompts]' \
5568
+ '(operation)' \
5669
{-l,--list}'[list describable tasks]' \
5770
{-a,--list-all}'[list all tasks]' \
5871
{-i,--init}'[create new Taskfile.yml]' \
5972
'(-*)'{-h,--help}'[show help]' \
6073
'(-*)--version[show version and exit]' \
6174
'*: :__task_list'
75+
# Experimental flags (require experiments to be enabled)
76+
# Uncomment when using GentleForce experiment:
77+
# '(--force-all)--force-all[force execution of task and all dependencies]'
78+
# Uncomment when using RemoteTaskfiles experiment:
79+
# '(--download)--download[download remote Taskfile]'
80+
# '(--offline)--offline[use only local or cached Taskfiles]'
81+
# '(--timeout)--timeout[timeout for remote Taskfile downloads]:duration: '
82+
# '(--clear-cache)--clear-cache[clear remote Taskfile cache]'
83+
# '(--expiry)--expiry[cache expiry duration]:duration: '
6284
}
6385

6486
# don't run the completion function when being source-ed or eval-ed

0 commit comments

Comments
 (0)