fix the code style error

Signed-off-by: Dong Gang <dong.gang@daocloud.io>
pull/8438/head
Dong Gang 5 years ago
parent 57bd8a71b0
commit 1dfe66aa85

@ -152,7 +152,7 @@ func addShowFlags(subCmd *cobra.Command, client *action.Show) {
f.BoolVar(&client.Devel, "devel", false, "use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored") f.BoolVar(&client.Devel, "devel", false, "use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored")
if subCmd.Name() == "values" { if subCmd.Name() == "values" {
f.StringVar(&client.JsonPathTemplate, "jsonpath", "", "use jsonpath output format") f.StringVar(&client.JSONPathTemplate, "jsonpath", "", "use jsonpath output format")
} }
addChartPathOptionsFlags(f, &client.ChartPathOptions) addChartPathOptionsFlags(f, &client.ChartPathOptions)

@ -20,12 +20,12 @@ import (
"fmt" "fmt"
"strings" "strings"
"helm.sh/helm/v3/pkg/chartutil"
"k8s.io/cli-runtime/pkg/printers" "k8s.io/cli-runtime/pkg/printers"
"sigs.k8s.io/yaml" "sigs.k8s.io/yaml"
"helm.sh/helm/v3/pkg/chart" "helm.sh/helm/v3/pkg/chart"
"helm.sh/helm/v3/pkg/chart/loader" "helm.sh/helm/v3/pkg/chart/loader"
"helm.sh/helm/v3/pkg/chartutil"
) )
// ShowOutputFormat is the format of the output of `helm show` // ShowOutputFormat is the format of the output of `helm show`
@ -55,7 +55,7 @@ type Show struct {
ChartPathOptions ChartPathOptions
Devel bool Devel bool
OutputFormat ShowOutputFormat OutputFormat ShowOutputFormat
JsonPathTemplate string JSONPathTemplate string
chart *chart.Chart // for testing chart *chart.Chart // for testing
} }
@ -89,10 +89,10 @@ func (s *Show) Run(chartpath string) (string, error) {
if s.OutputFormat == ShowAll { if s.OutputFormat == ShowAll {
fmt.Fprintln(&out, "---") fmt.Fprintln(&out, "---")
} }
if s.JsonPathTemplate != "" { if s.JSONPathTemplate != "" {
printer, err := printers.NewJSONPathPrinter(s.JsonPathTemplate) printer, err := printers.NewJSONPathPrinter(s.JSONPathTemplate)
if err != nil { if err != nil {
return "", fmt.Errorf("error parsing jsonpath %s, %v\n", s.JsonPathTemplate, err) return "", fmt.Errorf("error parsing jsonpath %s, %v", s.JSONPathTemplate, err)
} }
printer.Execute(&out, s.chart.Values) printer.Execute(&out, s.chart.Values)
} else { } else {

@ -72,7 +72,7 @@ func TestShowNoValues(t *testing.T) {
func TestShowValuesByJsonPathFormat(t *testing.T) { func TestShowValuesByJsonPathFormat(t *testing.T) {
client := NewShow(ShowValues) client := NewShow(ShowValues)
client.JsonPathTemplate = "{$.nestedKey.simpleKey}" client.JSONPathTemplate = "{$.nestedKey.simpleKey}"
client.chart = buildChart(withSampleValues()) client.chart = buildChart(withSampleValues())
output, err := client.Run("") output, err := client.Run("")
if err != nil { if err != nil {

Loading…
Cancel
Save