Skip to content

Commit

Permalink
use same default format as "config dump"
Browse files Browse the repository at this point in the history
  • Loading branch information
ardnew committed Feb 8, 2024
1 parent 3657d06 commit a1bf14f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions internal/cli/config/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ package config

import (
"encoding/json"
"fmt"
"os"

"github.com/arduino/arduino-cli/commands/daemon"
Expand All @@ -26,6 +25,7 @@ import (
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"gopkg.in/yaml.v3"
)

func initGetCommand() *cobra.Command {
Expand Down Expand Up @@ -77,5 +77,10 @@ func (gr getResult) Data() interface{} {
}

func (gr getResult) String() string {
return fmt.Sprintf("%v", gr.resp)
gs, err := yaml.Marshal(gr.resp)
if err != nil {
// Should never happen
panic(tr("unable to marshal config to YAML: %v", err))
}
return string(gs)
}

0 comments on commit a1bf14f

Please sign in to comment.