Skip to content

Commit

Permalink
fix: correct --no-color flag behaviour in non-tty environments (#1339)
Browse files Browse the repository at this point in the history
The non-tty environments had no option of getting a colorised output. This change retains the default behaviour of showing colors in tty and no colors in non-tty if no flag is passed. However, on passing the --no-color=false, non-tty environments can also get colored output.

Fix #1313
  • Loading branch information
Prashansa-K authored Jul 17, 2024
1 parent 200a471 commit 0cdef1e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,9 @@ func initConfig() {
// cookie-jar support
rootConfig.CookieJarPath = viper.GetString("kong-cookie-jar-path")

color.NoColor = (color.NoColor || viper.GetBool("no-color"))
if viper.IsSet("no-color") {
color.NoColor = viper.GetBool("no-color")
}

if err := initKonnectConfig(); err != nil {
fmt.Println(err)
Expand Down

0 comments on commit 0cdef1e

Please sign in to comment.