@@ -17,13 +17,13 @@ package config
1717
1818import (
1919 "os"
20- "reflect"
2120
21+ "github.com/arduino/arduino-cli/commands/daemon"
2222 "github.com/arduino/arduino-cli/internal/cli/configuration"
2323 "github.com/arduino/arduino-cli/internal/cli/feedback"
24+ rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
2425 "github.com/sirupsen/logrus"
2526 "github.com/spf13/cobra"
26- "gopkg.in/yaml.v3"
2727)
2828
2929func initGetCommand () * cobra.Command {
@@ -53,14 +53,15 @@ func runGetCommand(cmd *cobra.Command, args []string) {
5353 if err != nil {
5454 feedback .Fatal (tr ("Cannot get the key %[1]s: %[2]v" , toGet , err ), feedback .ErrGeneric )
5555 }
56- feedback .PrintResult (resp .GetJsonData ())
56+ feedback .PrintResult (getResult { key : toGet , data : resp .GetJsonData ()} )
5757 }
5858}
5959
6060// output from this command may require special formatting.
6161// create a dedicated feedback.Result implementation to safely handle
6262// any changes to the configuration.Settings struct.
6363type getResult struct {
64+ key string
6465 data interface {}
6566}
6667
@@ -69,10 +70,10 @@ func (gr getResult) Data() interface{} {
6970}
7071
7172func (gr getResult ) String () string {
72- gs , err := yaml . Marshal ( gr .data )
73- if err != nil {
73+ gs , ok := gr .data .( string )
74+ if ! ok {
7475 // Should never happen
75- panic (tr ("unable to marshal config to YAML : %v" , err ))
76+ panic (tr ("Cannot get key %s value as string : %v" , gr . key , gr . data ))
7677 }
77- return string ( gs )
78+ return gs
7879}
0 commit comments