feat: auto-detect color output in CI environments #2569
Merged
+49
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
fixes #1589
Running Task in CI often produces monochrome output, making it harder to scan logs and spot important information. This PR fixes that.
Task now automatically enables colored output when running in CI environments (
CI=true). This matches the behavior of popular tools like Terraform, cargo, npm, and pytest which all auto-detect CI and enable colors.Before
task: [build] go build -o ./bin/task ./cmd/task
task: [test] go test ./...
task: Failed to run task "test": exit status 1
Plain text wall - errors blend in with everything else.
After
Colored output with visual hierarchy - task names in green, errors in red, making logs scannable at a glance.
Why this matters
NO_COLORif neededChanges
CI=trueenvironment variablecoloroption to.taskrc.ymlfor global configurationNO_COLOR>FORCE_COLOR> CI > TTY defaultTest plan
CI=true task --listshows colored outputNO_COLOR=1 CI=true task --listhas no colors (NO_COLOR takes priority)task --color=falsedisables colors even withCI=truecolor: falsein~/.taskrc.ymldisables colors globally