Skip to content

Commit

Permalink
Don't use aec when NO_COLOR is defined
Browse files Browse the repository at this point in the history
Signed-off-by: Sean P. Kane <spkane00@gmail.com>
  • Loading branch information
spkane committed Jul 19, 2022
1 parent 268afb4 commit fed245f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion util/progress/progressui/display.go
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,9 @@ func (disp *display) print(d displayInfo, width, height int, all bool) {
} else if j.hasError {
color = colorError
}
out = aec.Apply(out, color)
if color != nil {
out = aec.Apply(out, color)
}
}
fmt.Fprint(disp.c, out)
lineCount++
Expand Down
8 changes: 4 additions & 4 deletions util/progress/progressui/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ var colorError aec.ANSI
func init() {
// As recommended on https://no-color.org/
if _, ok := os.LookupEnv("NO_COLOR"); ok {
colorRun = termColorMap["default"]
colorCancel = termColorMap["default"]
colorWarning = termColorMap["default"]
colorError = termColorMap["default"]
colorRun = nil
colorCancel = nil
colorWarning = nil
colorError = nil
return
} else if runtime.GOOS == "windows" {
colorRun = termColorMap["cyan"]
Expand Down

0 comments on commit fed245f

Please sign in to comment.