Add ability to set error_only: true on the group output mode

This commit is contained in:
Dennis Jekubczyk
2023-03-09 02:34:52 +01:00
committed by GitHub
parent 4b97d4f7f5
commit 88d644a7e9
13 changed files with 135 additions and 16 deletions

View File

@@ -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: