mirror of
https://github.com/helm/helm.git
synced 2026-04-04 08:35:26 -04:00
Refactor get values table header writer
Signed-off-by: Dean Coakley <dean.s.coakley@gmail.com>
This commit is contained in:
parent
df64ad1e10
commit
a831747dde
1 changed files with 9 additions and 12 deletions
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
|
@ -31,7 +32,8 @@ This command downloads a values file for a given release.
|
|||
`
|
||||
|
||||
type valuesWriter struct {
|
||||
vals map[string]interface{}
|
||||
vals map[string]interface{}
|
||||
allValues bool
|
||||
}
|
||||
|
||||
func newGetValuesCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
|
||||
|
|
@ -48,17 +50,7 @@ func newGetValuesCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if outfmt == output.Table && client.AllValues {
|
||||
_, err = out.Write([]byte("COMPUTED VALUES:\n"))
|
||||
} else if outfmt == output.Table {
|
||||
_, err = out.Write([]byte("USER-SUPPLIED VALUES:\n"))
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return outfmt.Write(out, &valuesWriter{vals})
|
||||
return outfmt.Write(out, &valuesWriter{vals, client.AllValues})
|
||||
},
|
||||
}
|
||||
|
||||
|
|
@ -71,6 +63,11 @@ func newGetValuesCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
|
|||
}
|
||||
|
||||
func (v valuesWriter) WriteTable(out io.Writer) error {
|
||||
if v.allValues {
|
||||
fmt.Fprintln(out, "COMPUTED VALUES:")
|
||||
} else {
|
||||
fmt.Fprintln(out, "USER-SUPPLIED VALUES:")
|
||||
}
|
||||
return output.EncodeYAML(out, v.vals)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue