Commit 8d14b19c authored by ymqytw's avatar ymqytw

check error

parent 7543bac5
...@@ -132,16 +132,19 @@ func (o *ViewLastAppliedOptions) Validate(cmd *cobra.Command) error { ...@@ -132,16 +132,19 @@ func (o *ViewLastAppliedOptions) Validate(cmd *cobra.Command) error {
func (o *ViewLastAppliedOptions) RunApplyViewLastApplied() error { func (o *ViewLastAppliedOptions) RunApplyViewLastApplied() error {
for _, str := range o.LastAppliedConfigurationList { for _, str := range o.LastAppliedConfigurationList {
yamlOutput, err := yaml.JSONToYAML([]byte(str))
switch o.OutputFormat { switch o.OutputFormat {
case "json": case "json":
jsonBuffer := &bytes.Buffer{} jsonBuffer := &bytes.Buffer{}
err = json.Indent(jsonBuffer, []byte(str), "", " ") err := json.Indent(jsonBuffer, []byte(str), "", " ")
if err != nil { if err != nil {
return err return err
} }
fmt.Fprintf(o.Out, string(jsonBuffer.Bytes())) fmt.Fprintf(o.Out, string(jsonBuffer.Bytes()))
case "yaml": case "yaml":
yamlOutput, err := yaml.JSONToYAML([]byte(str))
if err != nil {
return err
}
fmt.Fprintf(o.Out, string(yamlOutput)) fmt.Fprintf(o.Out, string(yamlOutput))
} }
} }
......
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