Skip to content

Commit cd22d59

Browse files
authored
Set HELM_DIFF_IGNORE_UNKNOWN_FLAGS=true to ignore unknown flags on helm-diff-upgrade (#328)
Resolves #278
1 parent fe77071 commit cd22d59

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

cmd/upgrade.go

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,16 @@ func newChartCommand() *cobra.Command {
8686
}
8787

8888
cmd := &cobra.Command{
89-
Use: "upgrade [flags] [RELEASE] [CHART]",
90-
Short: "Show a diff explaining what a helm upgrade would change.",
91-
Long: globalUsage,
92-
Example: " helm diff upgrade my-release stable/postgresql --values values.yaml",
89+
Use: "upgrade [flags] [RELEASE] [CHART]",
90+
Short: "Show a diff explaining what a helm upgrade would change.",
91+
Long: globalUsage,
92+
Example: strings.Join([]string{
93+
" helm diff upgrade my-release stable/postgresql --values values.yaml",
94+
"",
95+
" # Set HELM_DIFF_IGNORE_UNKNOWN_FLAGS=true to ignore unknown flags",
96+
" # It's useful when you're using `helm-diff` in a `helm upgrade` wrapper.",
97+
" HELM_DIFF_IGNORE_UNKNOWN_FLAGS=true helm diff upgrade my-release stable/postgres --wait",
98+
}, "\n"),
9399
Args: func(cmd *cobra.Command, args []string) error {
94100
return checkArgsLength(len(args), "release name", "chart path")
95101
},
@@ -114,6 +120,9 @@ func newChartCommand() *cobra.Command {
114120
}
115121
return diff.run()
116122
},
123+
FParseErrWhitelist: cobra.FParseErrWhitelist{
124+
UnknownFlags: os.Getenv("HELM_DIFF_IGNORE_UNKNOWN_FLAGS") == "true",
125+
},
117126
}
118127

119128
f := cmd.Flags()

0 commit comments

Comments
 (0)