Skip to content

Commit a1bf14f

Browse files
committed
use same default format as "config dump"
1 parent 3657d06 commit a1bf14f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Diff for: internal/cli/config/get.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ package config
1717

1818
import (
1919
"encoding/json"
20-
"fmt"
2120
"os"
2221

2322
"github.com/arduino/arduino-cli/commands/daemon"
@@ -26,6 +25,7 @@ import (
2625
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
2726
"github.com/sirupsen/logrus"
2827
"github.com/spf13/cobra"
28+
"gopkg.in/yaml.v3"
2929
)
3030

3131
func initGetCommand() *cobra.Command {
@@ -77,5 +77,10 @@ func (gr getResult) Data() interface{} {
7777
}
7878

7979
func (gr getResult) String() string {
80-
return fmt.Sprintf("%v", gr.resp)
80+
gs, err := yaml.Marshal(gr.resp)
81+
if err != nil {
82+
// Should never happen
83+
panic(tr("unable to marshal config to YAML: %v", err))
84+
}
85+
return string(gs)
8186
}

0 commit comments

Comments
 (0)