Skip to content

Commit e204677

Browse files
committed
Fixed no-colors regression #2218
1 parent f768159 commit e204677

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

cmd/root.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ yq -P -oy sample.json
7171
level := logging.WARNING
7272
stringFormat := `[%{level}] %{color}%{time:15:04:05}%{color:reset} %{message}`
7373

74+
// when NO_COLOR environment variable presents and not an empty string the coloured output should be disabled;
75+
// refer to no-color.org
76+
forceNoColor = forceNoColor || os.Getenv("NO_COLOR") != ""
77+
7478
if verbose && forceNoColor {
7579
level = logging.DEBUG
7680
stringFormat = `[%{level:5.5s}] %{time:15:04:05} %{shortfile:-33s} %{shortfunc:-25s} %{message}`
@@ -90,10 +94,6 @@ yq -P -oy sample.json
9094
logging.SetBackend(backend)
9195
yqlib.InitExpressionParser()
9296

93-
// when NO_COLOR environment variable presents and not an empty string the coloured output should be disabled;
94-
// refer to no-color.org
95-
forceNoColor = os.Getenv("NO_COLOR") != ""
96-
9797
return nil
9898
},
9999
}

0 commit comments

Comments
 (0)