@@ -17,13 +17,13 @@ package config
17
17
18
18
import (
19
19
"os"
20
- "reflect"
21
20
21
+ "github.com/arduino/arduino-cli/commands/daemon"
22
22
"github.com/arduino/arduino-cli/internal/cli/configuration"
23
23
"github.com/arduino/arduino-cli/internal/cli/feedback"
24
+ rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
24
25
"github.com/sirupsen/logrus"
25
26
"github.com/spf13/cobra"
26
- "gopkg.in/yaml.v3"
27
27
)
28
28
29
29
func initGetCommand () * cobra.Command {
@@ -53,14 +53,15 @@ func runGetCommand(cmd *cobra.Command, args []string) {
53
53
if err != nil {
54
54
feedback .Fatal (tr ("Cannot get the key %[1]s: %[2]v" , toGet , err ), feedback .ErrGeneric )
55
55
}
56
- feedback .PrintResult (resp .GetJsonData ())
56
+ feedback .PrintResult (getResult { key : toGet , data : resp .GetJsonData ()} )
57
57
}
58
58
}
59
59
60
60
// output from this command may require special formatting.
61
61
// create a dedicated feedback.Result implementation to safely handle
62
62
// any changes to the configuration.Settings struct.
63
63
type getResult struct {
64
+ key string
64
65
data interface {}
65
66
}
66
67
@@ -69,10 +70,10 @@ func (gr getResult) Data() interface{} {
69
70
}
70
71
71
72
func (gr getResult ) String () string {
72
- gs , err := yaml . Marshal ( gr .data )
73
- if err != nil {
73
+ gs , ok := gr .data .( string )
74
+ if ! ok {
74
75
// 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 ))
76
77
}
77
- return string ( gs )
78
+ return gs
78
79
}
0 commit comments