8000 add "config get" command to print settings values by ardnew · Pull Request #2307 · arduino/arduino-cli · GitHub
[go: up one dir, main page]

Skip to content

add "config get" command to print settings values #2307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Feb 14, 2024
Prev Previous commit
Next Next commit
use same default format as "config dump"
  • Loading branch information
ardnew committed Feb 8, 2024
commit c069ecea005cfa6a54bdc5165c0104d837d4c94a
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