feat: configure output flags via environment variables#2873
Conversation
trulede
left a comment
There was a problem hiding this comment.
The changes look good. Mods normally update the changelog themselves.
Comment: recently envars were added for (only) CLI options which are also present in the task config schema. For CI (non-interactive) use cases some other envars might be useful:
- status
- watch
- parallel
- exit-code
- dir
- taskfile
- interval
- global
- force
- force-all
|
I'll remove the changelog changes. |
Add environment variable equivalents for the output-related flags so grouped output can be enabled once at the CI/job level instead of on every task invocation: - TASK_OUTPUT (--output) - TASK_OUTPUT_GROUP_BEGIN (--output-group-begin) - TASK_OUTPUT_GROUP_END (--output-group-end) - TASK_OUTPUT_GROUP_ERROR_ONLY (--output-group-error-only) These are wired through the existing getConfig helper, so the usual precedence applies: CLI flag > env var > default. Closes go-task#2872
a869ce6 to
684dc16
Compare
Lets see what the mods say. I just noted it when reviewing the change. |
|
Gentle bump. I would greatly appreciate your time and eyes on this MR. |
|
I'll take a look tomorrow |
Summary
Closes #2872.
Adds environment-variable equivalents for the output-related flags so grouped output can be enabled once at the CI/job level (a single
variables:entry) instead of being repeated on everytaskinvocation or set unconditionally via the Taskfileoutput:key:--outputTASK_OUTPUT--output-group-beginTASK_OUTPUT_GROUP_BEGIN--output-group-endTASK_OUTPUT_GROUP_END--output-group-error-onlyTASK_OUTPUT_GROUP_ERROR_ONLYThese are wired through the existing
getConfighelper (the same mechanism used byTASK_VERBOSE,TASK_COLOR, etc.), so the usual precedence applies: CLI flag > env var > default. An explicit CLI flag still overrides the env var via pflag'sChangedtracking.Changes
internal/flags/flags.go: source the four output flag defaults fromTASK_*env vars.internal/flags/flags_test.go: unit tests for each env var, fallback-to-default, invalid-bool handling, and env > taskrc-config precedence.website/src/docs/reference/environment.md+cli.md: document the new env vars and cross-link them from the flags.CHANGELOG.md: Unreleased entry.Testing
go build ./...andgo vet ./...pass.go test ./internal/...passes (new flags tests included).TASK_OUTPUT=groupenables groupingTASK_OUTPUT_GROUP_BEGIN/ENDapply templates--output=group