Commit 9cfbbb34 authored by fibonacci1729's avatar fibonacci1729

fix(1245): hook up revision flag to helm get {manifest,values,hooks}

parent 715be826
...@@ -73,7 +73,7 @@ func newGetCmd(client helm.Interface, out io.Writer) *cobra.Command { ...@@ -73,7 +73,7 @@ func newGetCmd(client helm.Interface, out io.Writer) *cobra.Command {
}, },
} }
cmd.PersistentFlags().Int32Var(&get.version, "revision", 0, "get the named release with revision") cmd.Flags().Int32Var(&get.version, "revision", 0, "get the named release with revision")
cmd.AddCommand(newGetValuesCmd(nil, out)) cmd.AddCommand(newGetValuesCmd(nil, out))
cmd.AddCommand(newGetManifestCmd(nil, out)) cmd.AddCommand(newGetManifestCmd(nil, out))
......
...@@ -35,6 +35,7 @@ type getHooksCmd struct { ...@@ -35,6 +35,7 @@ type getHooksCmd struct {
release string release string
out io.Writer out io.Writer
client helm.Interface client helm.Interface
version int32
} }
func newGetHooksCmd(client helm.Interface, out io.Writer) *cobra.Command { func newGetHooksCmd(client helm.Interface, out io.Writer) *cobra.Command {
...@@ -55,11 +56,12 @@ func newGetHooksCmd(client helm.Interface, out io.Writer) *cobra.Command { ...@@ -55,11 +56,12 @@ func newGetHooksCmd(client helm.Interface, out io.Writer) *cobra.Command {
return ghc.run() return ghc.run()
}, },
} }
cmd.Flags().Int32Var(&ghc.version, "revision", 0, "get the named release with revision")
return cmd return cmd
} }
func (g *getHooksCmd) run() error { func (g *getHooksCmd) run() error {
res, err := g.client.ReleaseContent(g.release) res, err := g.client.ReleaseContent(g.release, helm.ContentReleaseVersion(g.version))
if err != nil { if err != nil {
fmt.Fprintln(g.out, g.release) fmt.Fprintln(g.out, g.release)
return prettyError(err) return prettyError(err)
......
...@@ -37,6 +37,7 @@ type getManifestCmd struct { ...@@ -37,6 +37,7 @@ type getManifestCmd struct {
release string release string
out io.Writer out io.Writer
client helm.Interface client helm.Interface
version int32
} }
func newGetManifestCmd(client helm.Interface, out io.Writer) *cobra.Command { func newGetManifestCmd(client helm.Interface, out io.Writer) *cobra.Command {
...@@ -59,12 +60,14 @@ func newGetManifestCmd(client helm.Interface, out io.Writer) *cobra.Command { ...@@ -59,12 +60,14 @@ func newGetManifestCmd(client helm.Interface, out io.Writer) *cobra.Command {
return get.run() return get.run()
}, },
} }
cmd.Flags().Int32Var(&get.version, "revision", 0, "get the named release with revision")
return cmd return cmd
} }
// getManifest implements 'helm get manifest' // getManifest implements 'helm get manifest'
func (g *getManifestCmd) run() error { func (g *getManifestCmd) run() error {
res, err := g.client.ReleaseContent(g.release) res, err := g.client.ReleaseContent(g.release, helm.ContentReleaseVersion(g.version))
if err != nil { if err != nil {
return prettyError(err) return prettyError(err)
} }
......
...@@ -35,6 +35,7 @@ type getValuesCmd struct { ...@@ -35,6 +35,7 @@ type getValuesCmd struct {
allValues bool allValues bool
out io.Writer out io.Writer
client helm.Interface client helm.Interface
version int32
} }
func newGetValuesCmd(client helm.Interface, out io.Writer) *cobra.Command { func newGetValuesCmd(client helm.Interface, out io.Writer) *cobra.Command {
...@@ -55,13 +56,15 @@ func newGetValuesCmd(client helm.Interface, out io.Writer) *cobra.Command { ...@@ -55,13 +56,15 @@ func newGetValuesCmd(client helm.Interface, out io.Writer) *cobra.Command {
return get.run() return get.run()
}, },
} }
cmd.Flags().Int32Var(&get.version, "revision", 0, "get the named release with revision")
cmd.Flags().BoolVarP(&get.allValues, "all", "a", false, "dump all (computed) values") cmd.Flags().BoolVarP(&get.allValues, "all", "a", false, "dump all (computed) values")
return cmd return cmd
} }
// getValues implements 'helm get values' // getValues implements 'helm get values'
func (g *getValuesCmd) run() error { func (g *getValuesCmd) run() error {
res, err := g.client.ReleaseContent(g.release) res, err := g.client.ReleaseContent(g.release, helm.ContentReleaseVersion(g.version))
if err != nil { if err != nil {
return prettyError(err) return prettyError(err)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment