Skip to content

Commit c34feed

Browse files
authored
Merge pull request #586 from eata219/fix-dyff-when-piped
2 parents d05c148 + fb905dc commit c34feed

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

.golangci.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ linters-settings:
155155
- github.com/aryann/difflib
156156
- github.com/databus23/helm-diff/v3
157157
- github.com/evanphx/json-patch
158+
- github.com/gonvenience/bunt
158159
- github.com/gonvenience/ytbx
159160
- github.com/google/go-cmp/cmp
160161
- github.com/homeport/dyff/pkg/dyff

cmd/root.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"strconv"
66
"strings"
77

8+
"github.com/gonvenience/bunt"
89
"github.com/mgutz/ansi"
910
"github.com/spf13/cobra"
1011
"golang.org/x/term"
@@ -61,15 +62,19 @@ func New() *cobra.Command {
6162
}
6263
}
6364

65+
// Dyff relies on bunt, default to color=on
66+
bunt.SetColorSettings(bunt.ON, bunt.ON)
6467
nc, _ := cmd.Flags().GetBool("no-color")
6568

6669
if nc || (fc != nil && !*fc) {
6770
ansi.DisableColors(true)
71+
bunt.SetColorSettings(bunt.OFF, bunt.OFF)
6872
} else if !cmd.Flags().Changed("no-color") && fc == nil {
6973
term := term.IsTerminal(int(os.Stdout.Fd()))
7074
// https://github.com/databus23/helm-diff/issues/281
7175
dumb := os.Getenv("TERM") == "dumb"
7276
ansi.DisableColors(!term || dumb)
77+
bunt.SetColorSettings(bunt.OFF, bunt.OFF)
7378
}
7479
},
7580
RunE: func(cmd *cobra.Command, args []string) error {

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ require (
2525
)
2626

2727
require (
28+
github.com/gonvenience/bunt v1.3.5
2829
github.com/gonvenience/ytbx v1.4.4
2930
github.com/google/go-cmp v0.6.0
3031
github.com/homeport/dyff v1.7.1
@@ -70,7 +71,6 @@ require (
7071
github.com/gobwas/glob v0.2.3 // indirect
7172
github.com/gogo/protobuf v1.3.2 // indirect
7273
github.com/golang/protobuf v1.5.4 // indirect
73-
github.com/gonvenience/bunt v1.3.5 // indirect
7474
github.com/gonvenience/neat v1.3.13 // indirect
7575
github.com/gonvenience/term v1.0.2 // indirect
7676
github.com/gonvenience/text v1.0.7 // indirect

0 commit comments

Comments
 (0)