Skip to content

Commit fe77071

Browse files
authored
Disable colors when TERM=dumb (#327)
Fixes #281
1 parent ff9fe31 commit fe77071

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cmd/root.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ func New() *cobra.Command {
4444
if nc, _ := cmd.Flags().GetBool("no-color"); nc {
4545
ansi.DisableColors(true)
4646
} else if !cmd.Flags().Changed("no-color") {
47-
ansi.DisableColors(!terminal.IsTerminal(int(os.Stdout.Fd())))
47+
term := terminal.IsTerminal(int(os.Stdout.Fd()))
48+
// https://github.com/databus23/helm-diff/issues/281
49+
dumb := os.Getenv("TERM") == "dumb"
50+
ansi.DisableColors(!term || dumb)
4851
}
4952
},
5053
RunE: func(cmd *cobra.Command, args []string) error {

0 commit comments

Comments
 (0)