Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 47c09a8

Browse files
committed
config/get: do not wrap JSON output in YAML
1 parent fbb8d50 commit 47c09a8

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

‎internal/cli/config/get.go‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ package config
1717

1818
import (
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

2929
func 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.
6363
type getResult struct {
64+
key string
6465
data interface{}
6566
}
6667

@@ -69,10 +70,10 @@ func (gr getResult) Data() interface{} {
6970
}
7071

7172
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 {
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

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /