Skip to content

Commit adda96f

Browse files
authored
Merge pull request #416 from cwrau/feature/output-format-from-environment
feature(output): add environment variable for diff output format
2 parents 704355f + 81fe592 commit adda96f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cmd/root.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package cmd
33
import (
44
"os"
55
"strconv"
6+
"strings"
67

78
"github.com/mgutz/ansi"
89
"github.com/spf13/cobra"
@@ -54,6 +55,13 @@ func New() *cobra.Command {
5455
}
5556
}
5657

58+
if !cmd.Flags().Changed("output") {
59+
v, set := os.LookupEnv("HELM_DIFF_OUTPUT")
60+
if set && strings.TrimSpace(v) != "" {
61+
_ = cmd.Flags().Set("output", v)
62+
}
63+
}
64+
5765
nc, _ := cmd.Flags().GetBool("no-color")
5866

5967
if nc || (fc != nil && !*fc) {

0 commit comments

Comments
 (0)