mirror of
https://github.com/go-task/task.git
synced 2026-06-24 21:26:04 +00:00
Add ability to set error_only: true on the group output mode
This commit is contained in:
@@ -36,6 +36,7 @@ variable
|
||||
| `-o` | `--output` | `string` | Default set in the Taskfile or `intervealed` | Sets output style: [`interleaved`/`group`/`prefixed`]. |
|
||||
| | `--output-group-begin` | `string` | | Message template to print before a task's grouped output. |
|
||||
| | `--output-group-end` | `string` | | Message template to print after a task's grouped output. |
|
||||
| | `--output-group-error-only` | `bool` | `false` | Swallow command output on zero exit code. |
|
||||
| `-p` | `--parallel` | `bool` | `false` | Executes tasks provided on command line in parallel. |
|
||||
| `-s` | `--silent` | `bool` | `false` | Disables echoing. |
|
||||
| | `--status` | `bool` | `false` | Exits with non-zero exit code if any of the given tasks is not up-to-date. |
|
||||
|
||||
@@ -1342,6 +1342,30 @@ Hello, World!
|
||||
::endgroup::
|
||||
```
|
||||
|
||||
When using the `group` output, you may swallow the output of the executed command
|
||||
on standard output and standard error if it does not fail (zero exit code).
|
||||
|
||||
```yaml
|
||||
version: '3'
|
||||
|
||||
silent: true
|
||||
|
||||
output:
|
||||
group:
|
||||
error_only: true
|
||||
|
||||
tasks:
|
||||
passes: echo 'output-of-passes'
|
||||
errors: echo 'output-of-errors' && exit 1
|
||||
```
|
||||
|
||||
```bash
|
||||
$ task passes
|
||||
$ task errors
|
||||
output-of-errors
|
||||
task: Failed to run task "errors": exit status 1
|
||||
```
|
||||
|
||||
The `prefix` output will prefix every line printed by a command with
|
||||
`[task-name] ` as the prefix, but you can customize the prefix for a command
|
||||
with the `prefix:` attribute:
|
||||
|
||||
Reference in New Issue
Block a user