Commit 5c53f868 authored by Adam Reese's avatar Adam Reese

fix(cmd): remove --file flag for helm get

Users can redirect stdout to a file
parent 62eb4f3a
...@@ -19,7 +19,6 @@ package main ...@@ -19,7 +19,6 @@ package main
import ( import (
"errors" "errors"
"fmt" "fmt"
"os"
"time" "time"
"github.com/spf13/cobra" "github.com/spf13/cobra"
...@@ -56,11 +55,6 @@ were generated from this release's chart(s). If a chart is dependent on other ...@@ -56,11 +55,6 @@ were generated from this release's chart(s). If a chart is dependent on other
charts, those resources will also be included in the manifest. charts, those resources will also be included in the manifest.
` `
// getOut is the filename to direct output.
//
// If it is blank, output is sent to os.Stdout.
var getOut = ""
var allValues = false var allValues = false
var errReleaseRequired = errors.New("release name is required") var errReleaseRequired = errors.New("release name is required")
...@@ -88,9 +82,6 @@ var getManifestCommand = &cobra.Command{ ...@@ -88,9 +82,6 @@ var getManifestCommand = &cobra.Command{
} }
func init() { func init() {
// 'get' command flags.
getCommand.PersistentFlags().StringVarP(&getOut, "file", "f", "", "output file")
// 'get values' flags. // 'get values' flags.
getValuesCommand.PersistentFlags().BoolVarP(&allValues, "all", "a", false, "dump all (computed) values") getValuesCommand.PersistentFlags().BoolVarP(&allValues, "all", "a", false, "dump all (computed) values")
...@@ -151,10 +142,12 @@ func getValues(cmd *cobra.Command, args []string) error { ...@@ -151,10 +142,12 @@ func getValues(cmd *cobra.Command, args []string) error {
if err != nil { if err != nil {
return err return err
} }
return getToFile(cfgStr) fmt.Println(cfgStr)
return nil
} }
return getToFile(res.Release.Config.Raw) fmt.Println(res.Release.Config.Raw)
return nil
} }
// getManifest implements 'helm get manifest' // getManifest implements 'helm get manifest'
...@@ -167,19 +160,6 @@ func getManifest(cmd *cobra.Command, args []string) error { ...@@ -167,19 +160,6 @@ func getManifest(cmd *cobra.Command, args []string) error {
if err != nil { if err != nil {
return prettyError(err) return prettyError(err)
} }
return getToFile(res.Release.Manifest) fmt.Println(res.Release.Manifest)
}
func getToFile(v interface{}) error {
out := os.Stdout
if len(getOut) > 0 {
t, err := os.Create(getOut)
if err != nil {
return fmt.Errorf("failed to create %s: %s", getOut, err)
}
defer t.Close()
out = t
}
fmt.Fprintln(out, v)
return nil return nil
} }
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