Skip to content

Commit

Permalink
Documented NO_COLOR environment variable.
Browse files Browse the repository at this point in the history
Signed-off-by: Springcomp <[email protected]>
  • Loading branch information
springcomp committed Mar 21, 2023
1 parent ea85366 commit 821337d
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions jp.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,15 @@ func runMain(c *cli.Context) int {
}
expression = c.Args()[0]
}
// NoColor defines if the output is colorized or not. It's dynamically set to
// false or true based on the stdout's file descriptor referring to a terminal
// or not. It's also set to true if the NO_COLOR environment variable is
// set (regardless of its value). This is a global option and affects all
// colors.
switch c.String("color") {
case "always":
enableColor(true)
case "auto":
// this is the default in the library
// this requests the default behaviour in the jsoncolor library
// color output is enabled or disabled dynamically based on the
// stdout's file descriptor referring to a terminal or not.
// Additionally, if the NO_COLOR environment variable is set
// (regardless of its value) color output will be disabled.
case "never":
enableColor(false)
default:
Expand Down

0 comments on commit 821337d

Please sign in to comment.