Skip to content

Commit

Permalink
Allow chart versioning
Browse files Browse the repository at this point in the history
We rename the existing version flag
and re-use the existing helm version flag.
This allow helm-diff to seamlessly work with
other helm tooling such as helmfile
  • Loading branch information
Saurabh Sharma committed Apr 3, 2018
1 parent 1d3b781 commit f08186d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ var Version = "HEAD"
type diffCmd struct {
release string
chart string
chartVersion string
client helm.Interface
valueFiles valueFiles
values []string
Expand All @@ -42,8 +43,8 @@ func main() {
Short: "Show manifest differences",
Long: globalUsage,
RunE: func(cmd *cobra.Command, args []string) error {
if v, _ := cmd.Flags().GetBool("version"); v {
fmt.Println(Version)
if v, _ := cmd.Flags().GetBool("diff-version"); v {
fmt.Println("Version", Version)
return nil
}

Expand All @@ -69,9 +70,10 @@ func main() {
}

f := cmd.Flags()
f.BoolP("version", "v", false, "show version")
f.BoolP("diff-version", "", false, "show diff version")
f.BoolP("suppress-secrets", "q", false, "suppress secrets in the output")
f.Bool("no-color", false, "remove colors from the output")
f.StringVarP(&diff.chartVersion, "version", "v", "", "specify the chart version")
f.VarP(&diff.valueFiles, "values", "f", "specify values in a YAML file (can specify multiple)")
f.StringArrayVar(&diff.values, "set", []string{}, "set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)")
f.BoolVar(&diff.reuseValues, "reuse-values", false, "reuse the last release's values and merge in any new values")
Expand All @@ -84,7 +86,7 @@ func main() {
}

func (d *diffCmd) run() error {
chartPath, err := locateChartPath(d.chart, "", false, "")
chartPath, err := locateChartPath(d.chart, d.chartVersion, false, "")
if err != nil {
return err
}
Expand Down

0 comments on commit f08186d

Please sign in to comment.