mirror of
https://github.com/go-task/task.git
synced 2025-01-12 04:34:11 +02:00
Add FORCE_COLOR env support (#1003)
This commit is contained in:
parent
c8fe450623
commit
9af056e746
@ -4,6 +4,7 @@
|
||||
|
||||
- Fixed a bug where tasks were sometimes incorrectly marked as internal ([#1007](https://github.com/go-task/task/pull/1007) by @pd93).
|
||||
- Update to Go 1.20 (bump minimum version to 1.19) ([#1010](https://github.com/go-task/task/pull/1010) by @pd93)
|
||||
- Added environment variable `FORCE_COLOR` support to force color output. Usefull for environments without TTY ([#1003](https://github.com/go-task/task/pull/1003) by @automation-stack)
|
||||
|
||||
## v3.20.0 - 2023-01-14
|
||||
|
||||
|
@ -73,6 +73,7 @@ Some environment variables can be overriden to adjust Task behavior.
|
||||
| `TASK_COLOR_YELLOW` | `33` | Color used for yellow. |
|
||||
| `TASK_COLOR_MAGENTA` | `35` | Color used for magenta. |
|
||||
| `TASK_COLOR_RED` | `31` | Color used for red. |
|
||||
| `FORCE_COLOR` | `undefined` | Force color output usage. |
|
||||
|
||||
## Schema
|
||||
|
||||
|
@ -34,6 +34,10 @@ func Red() PrintFunc {
|
||||
}
|
||||
|
||||
func envColor(env string, defaultColor color.Attribute) color.Attribute {
|
||||
if os.Getenv("FORCE_COLOR") != "" {
|
||||
color.NoColor = false
|
||||
}
|
||||
|
||||
override, err := strconv.Atoi(os.Getenv(env))
|
||||
if err == nil {
|
||||
return color.Attribute(override)
|
||||
|
Loading…
Reference in New Issue
Block a user