Skip to content

Commit

Permalink
Fixed no-colors regression #2218
Browse files Browse the repository at this point in the history
  • Loading branch information
mikefarah committed Dec 7, 2024
1 parent f768159 commit e204677
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ yq -P -oy sample.json
level := logging.WARNING
stringFormat := `[%{level}] %{color}%{time:15:04:05}%{color:reset} %{message}`

// when NO_COLOR environment variable presents and not an empty string the coloured output should be disabled;
// refer to no-color.org
forceNoColor = forceNoColor || os.Getenv("NO_COLOR") != ""

if verbose && forceNoColor {
level = logging.DEBUG
stringFormat = `[%{level:5.5s}] %{time:15:04:05} %{shortfile:-33s} %{shortfunc:-25s} %{message}`
Expand All @@ -90,10 +94,6 @@ yq -P -oy sample.json
logging.SetBackend(backend)
yqlib.InitExpressionParser()

// when NO_COLOR environment variable presents and not an empty string the coloured output should be disabled;
// refer to no-color.org
forceNoColor = os.Getenv("NO_COLOR") != ""

return nil
},
}
Expand Down

0 comments on commit e204677

Please sign in to comment.