From 666e83342107a3006a83205cb3cac1acf50eb11c Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Tue, 26 Mar 2024 18:26:33 +0100 Subject: [PATCH] DRAFT --- commands/instances.go | 18 +- commands/service.go | 10 +- commands/service_cache_clean.go | 3 +- commands/service_compile.go | 13 +- commands/service_platform_search_test.go | 24 +- commands/service_settings.go | 187 +- commands/service_settings_test.go | 354 ++-- commands/service_sketch_load_test.go | 3 +- commands/service_sketch_new_test.go | 11 +- go.mod | 5 +- .../arduino/cores/packagemanager/loader.go | 2 +- .../packagemanager/package_manager_test.go | 6 +- .../arduino/cores/packagemanager/profiles.go | 4 +- internal/cli/arguments/reference_test.go | 5 +- internal/cli/cache/clean.go | 2 +- internal/cli/cli.go | 128 +- internal/cli/compile/compile.go | 12 +- internal/cli/config/add.go | 62 +- internal/cli/config/config.go | 60 +- internal/cli/config/delete.go | 26 +- internal/cli/config/dump.go | 51 +- internal/cli/config/get.go | 9 +- internal/cli/config/init.go | 41 +- internal/cli/config/remove.go | 43 +- internal/cli/config/set.go | 56 +- internal/cli/config/validate.go | 61 - internal/cli/configuration/build_cache.go | 34 + internal/cli/configuration/configuration.go | 98 +- internal/cli/configuration/defaults.go | 47 +- internal/cli/configuration/directories.go | 56 +- internal/cli/configuration/network.go | 12 +- internal/cli/configuration/sketch.go | 25 + internal/cli/daemon/daemon.go | 36 +- internal/cli/lib/install.go | 5 +- internal/cli/lib/lib.go | 3 +- internal/cli/lib/search.go | 1 + internal/docsgen/main.go | 16 +- main.go | 42 +- rpc/cc/arduino/cli/commands/v1/commands.pb.go | 152 +- rpc/cc/arduino/cli/commands/v1/commands.proto | 27 +- .../cli/commands/v1/commands_grpc.pb.go | 186 +- rpc/cc/arduino/cli/commands/v1/settings.pb.go | 1621 ++++++++++++++--- rpc/cc/arduino/cli/commands/v1/settings.proto | 142 +- rpc/internal/client_example/main.go | 103 +- 44 files changed, 2528 insertions(+), 1274 deletions(-) delete mode 100644 internal/cli/config/validate.go create mode 100644 internal/cli/configuration/build_cache.go create mode 100644 internal/cli/configuration/sketch.go diff --git a/commands/instances.go b/commands/instances.go index 7d461be1fc8..05e0b2876b6 100644 --- a/commands/instances.go +++ b/commands/instances.go @@ -36,7 +36,6 @@ import ( "github.com/arduino/arduino-cli/internal/arduino/resources" "github.com/arduino/arduino-cli/internal/arduino/sketch" "github.com/arduino/arduino-cli/internal/arduino/utils" - "github.com/arduino/arduino-cli/internal/cli/configuration" "github.com/arduino/arduino-cli/internal/i18n" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" paths "github.com/arduino/go-paths-helper" @@ -72,7 +71,7 @@ func (s *arduinoCoreServerImpl) Create(ctx context.Context, req *rpc.CreateReque } // Setup downloads directory - downloadsDir := configuration.DownloadsDir(s.settings) + downloadsDir := s.settings.DownloadsDir() if downloadsDir.NotExist() { err := downloadsDir.MkdirAll() if err != nil { @@ -81,8 +80,8 @@ func (s *arduinoCoreServerImpl) Create(ctx context.Context, req *rpc.CreateReque } // Setup data directory - dataDir := configuration.DataDir(s.settings) - packagesDir := configuration.PackagesDir(s.settings) + dataDir := s.settings.DataDir() + packagesDir := s.settings.PackagesDir() if packagesDir.NotExist() { err := packagesDir.MkdirAll() if err != nil { @@ -192,7 +191,7 @@ func (s *arduinoCoreServerImpl) Init(req *rpc.InitRequest, stream rpc.ArduinoCor } } - if err := firstUpdate(ctx, s, req.GetInstance(), configuration.DataDir(s.settings), downloadCallback, allPackageIndexUrls); err != nil { + if err := firstUpdate(ctx, s, req.GetInstance(), s.settings.DataDir(), downloadCallback, allPackageIndexUrls); err != nil { e := &cmderrors.InitFailedError{ Code: codes.InvalidArgument, Cause: err, @@ -349,7 +348,7 @@ func (s *arduinoCoreServerImpl) Init(req *rpc.InitRequest, stream rpc.ArduinoCor if profile == nil { // Add directories of libraries bundled with IDE - if bundledLibsDir := configuration.IDEBuiltinLibrariesDir(s.settings); bundledLibsDir != nil { + if bundledLibsDir := s.settings.IDEBuiltinLibrariesDir(); bundledLibsDir != nil { lmb.AddLibrariesDir(librariesmanager.LibrariesDir{ Path: bundledLibsDir, Location: libraries.IDEBuiltIn, @@ -358,14 +357,14 @@ func (s *arduinoCoreServerImpl) Init(req *rpc.InitRequest, stream rpc.ArduinoCor // Add libraries directory from config file lmb.AddLibrariesDir(librariesmanager.LibrariesDir{ - Path: configuration.LibrariesDir(s.settings), + Path: s.settings.LibrariesDir(), Location: libraries.User, }) } else { // Load libraries required for profile for _, libraryRef := range profile.Libraries { uid := libraryRef.InternalUniqueIdentifier() - libRoot := configuration.ProfilesCacheDir(s.settings).Join(uid) + libRoot := s.settings.ProfilesCacheDir().Join(uid) libDir := libRoot.Join(libraryRef.Library) if !libDir.IsDir() { @@ -548,7 +547,7 @@ func (s *arduinoCoreServerImpl) UpdateIndex(req *rpc.UpdateIndexRequest, stream Message: &rpc.UpdateIndexResponse_DownloadProgress{DownloadProgress: p}, }) } - indexpath := configuration.DataDir(s.settings) + indexpath := s.settings.DataDir() urls := []string{globals.DefaultIndexURL} if !req.GetIgnoreCustomPackageIndexes() { @@ -614,6 +613,7 @@ func (s *arduinoCoreServerImpl) UpdateIndex(req *rpc.UpdateIndexRequest, stream downloadCB.Start(u, tr("Downloading index: %s", filepath.Base(URL.Path))) downloadCB.End(false, tr("Invalid network configuration: %s", err)) failed = true + continue } if strings.HasSuffix(URL.Host, "arduino.cc") && strings.HasSuffix(URL.Path, ".json") { diff --git a/commands/service.go b/commands/service.go index 03da5135b29..d7292dcffcb 100644 --- a/commands/service.go +++ b/commands/service.go @@ -20,27 +20,25 @@ import ( "github.com/arduino/arduino-cli/internal/cli/configuration" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" + "github.com/arduino/arduino-cli/version" ) // NewArduinoCoreServer returns an implementation of the ArduinoCoreService gRPC service // that uses the provided version string. -func NewArduinoCoreServer(version string, settings *configuration.Settings) rpc.ArduinoCoreServiceServer { +func NewArduinoCoreServer() rpc.ArduinoCoreServiceServer { return &arduinoCoreServerImpl{ - versionString: version, - settings: settings, + settings: configuration.NewSettings(), } } type arduinoCoreServerImpl struct { rpc.UnsafeArduinoCoreServiceServer // Force compile error for unimplemented methods - versionString string - // Settings holds configurations of the CLI and the gRPC consumers settings *configuration.Settings } // Version returns the version of the Arduino CLI func (s *arduinoCoreServerImpl) Version(ctx context.Context, req *rpc.VersionRequest) (*rpc.VersionResponse, error) { - return &rpc.VersionResponse{Version: s.versionString}, nil + return &rpc.VersionResponse{Version: version.VersionInfo.VersionString}, nil } diff --git a/commands/service_cache_clean.go b/commands/service_cache_clean.go index df7a091f635..5897ebd2e99 100644 --- a/commands/service_cache_clean.go +++ b/commands/service_cache_clean.go @@ -18,13 +18,12 @@ package commands import ( "context" - "github.com/arduino/arduino-cli/internal/cli/configuration" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" ) // CleanDownloadCacheDirectory clean the download cache directory (where archives are downloaded). func (s *arduinoCoreServerImpl) CleanDownloadCacheDirectory(ctx context.Context, req *rpc.CleanDownloadCacheDirectoryRequest) (*rpc.CleanDownloadCacheDirectoryResponse, error) { - cachePath := configuration.DownloadsDir(s.settings) + cachePath := s.settings.DownloadsDir() err := cachePath.RemoveAll() if err != nil { return nil, err diff --git a/commands/service_compile.go b/commands/service_compile.go index d7320caeed2..9722c72671a 100644 --- a/commands/service_compile.go +++ b/commands/service_compile.go @@ -32,7 +32,6 @@ import ( "github.com/arduino/arduino-cli/internal/arduino/sketch" "github.com/arduino/arduino-cli/internal/arduino/utils" "github.com/arduino/arduino-cli/internal/buildcache" - "github.com/arduino/arduino-cli/internal/cli/configuration" "github.com/arduino/arduino-cli/internal/inventory" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" paths "github.com/arduino/go-paths-helper" @@ -67,7 +66,7 @@ func (s *arduinoCoreServerImpl) Compile(req *rpc.CompileRequest, stream rpc.Ardu ctx := stream.Context() syncSend := NewSynchronizedSend(stream.Send) - exportBinaries := s.settings.GetBool("sketch.always_export_binaries") + exportBinaries := s.settings.SketchAlwaysExportBinaries() if e := req.ExportBinaries; e != nil { exportBinaries = *e } @@ -175,8 +174,8 @@ func (s *arduinoCoreServerImpl) Compile(req *rpc.CompileRequest, stream rpc.Ardu // cache is purged after compilation to not remove entries that might be required defer maybePurgeBuildCache( - s.settings.GetUint("build_cache.compilations_before_purge"), - s.settings.GetDuration("build_cache.ttl").Abs()) + s.settings.GetCompilationsBeforeBuildCachePurge(), + s.settings.GetBuildCacheTTL().Abs()) var coreBuildCachePath *paths.Path if req.GetBuildCachePath() == "" { @@ -198,7 +197,7 @@ func (s *arduinoCoreServerImpl) Compile(req *rpc.CompileRequest, stream rpc.Ardu actualPlatform := buildPlatform otherLibrariesDirs := paths.NewPathList(req.GetLibraries()...) - otherLibrariesDirs.Add(configuration.LibrariesDir(s.settings)) + otherLibrariesDirs.Add(s.settings.LibrariesDir()) var libsManager *librariesmanager.LibrariesManager if pme.GetProfile() != nil { @@ -231,9 +230,9 @@ func (s *arduinoCoreServerImpl) Compile(req *rpc.CompileRequest, stream rpc.Ardu coreBuildCachePath, int(req.GetJobs()), req.GetBuildProperties(), - configuration.HardwareDirectories(s.settings), + s.settings.HardwareDirectories(), otherLibrariesDirs, - configuration.IDEBuiltinLibrariesDir(s.settings), + s.settings.IDEBuiltinLibrariesDir(), fqbn, req.GetClean(), req.GetSourceOverride(), diff --git a/commands/service_platform_search_test.go b/commands/service_platform_search_test.go index 3b7b87cf30d..1fa9ccdbbe3 100644 --- a/commands/service_platform_search_test.go +++ b/commands/service_platform_search_test.go @@ -19,7 +19,6 @@ import ( "context" "testing" - "github.com/arduino/arduino-cli/internal/cli/configuration" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" "github.com/arduino/go-paths-helper" "github.com/stretchr/testify/require" @@ -36,9 +35,17 @@ func TestPlatformSearch(t *testing.T) { err := paths.New("testdata", "platform", "package_index.json").CopyTo(dataDir.Join("package_index.json")) require.Nil(t, err) - settings := configuration.Init(paths.TempDir().Join("test", "arduino-cli.yaml").String()) - srv := NewArduinoCoreServer("", settings) ctx := context.Background() + srv := NewArduinoCoreServer() + + conf, err := paths.TempDir().Join("test", "arduino-cli.yaml").ReadFile() + require.NoError(t, err) + _, err = srv.ConfigurationOpen(ctx, &rpc.ConfigurationOpenRequest{ + Format: "yaml", + EncodedSettings: string(conf), + }) + require.NoError(t, err) + createResp, err := srv.Create(ctx, &rpc.CreateRequest{}) require.NoError(t, err) @@ -337,9 +344,16 @@ func TestPlatformSearchSorting(t *testing.T) { err := paths.New("testdata", "platform", "package_index.json").CopyTo(dataDir.Join("package_index.json")) require.Nil(t, err) - settings := configuration.Init(paths.TempDir().Join("test", "arduino-cli.yaml").String()) - srv := NewArduinoCoreServer("", settings) ctx := context.Background() + srv := NewArduinoCoreServer() + + conf, err := paths.TempDir().Join("test", "arduino-cli.yaml").ReadFile() + require.NoError(t, err) + _, err = srv.ConfigurationOpen(ctx, &rpc.ConfigurationOpenRequest{ + Format: "yaml", + EncodedSettings: string(conf), + }) + require.NoError(t, err) createResp, err := srv.Create(ctx, &rpc.CreateRequest{}) require.NoError(t, err) diff --git a/commands/service_settings.go b/commands/service_settings.go index 177d0819178..44f26b42ef4 100644 --- a/commands/service_settings.go +++ b/commands/service_settings.go @@ -18,161 +18,88 @@ package commands import ( "context" "encoding/json" - "errors" "fmt" - "strings" + "reflect" - "github.com/arduino/arduino-cli/internal/cli/configuration" + "github.com/arduino/arduino-cli/commands/cmderrors" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" ) -// SettingsGetAll returns a message with a string field containing all the settings -// currently in use, marshalled in JSON format. -func (s *arduinoCoreServerImpl) SettingsGetAll(ctx context.Context, req *rpc.SettingsGetAllRequest) (*rpc.SettingsGetAllResponse, error) { - b, err := json.Marshal(s.settings.AllSettings()) - if err == nil { - return &rpc.SettingsGetAllResponse{ - JsonData: string(b), - }, nil - } - - return nil, err +// SettingsGetValue returns a settings value given its key. If the key is not present +// an error will be returned, so that we distinguish empty settings from missing +// ones. +func (s *arduinoCoreServerImpl) ConfigurationGet(ctx context.Context, req *rpc.ConfigurationGetRequest) (*rpc.ConfigurationGetResponse, error) { + // TODO + return &rpc.ConfigurationGetResponse{}, nil } -// mapper converts a map of nested maps to a map of scalar values. -// For example: -// -// {"foo": "bar", "daemon":{"port":"420"}, "sketch": {"always_export_binaries": "true"}} -// -// would convert to: -// -// {"foo": "bar", "daemon.port":"420", "sketch.always_export_binaries": "true"} -func mapper(toMap map[string]interface{}) map[string]interface{} { - res := map[string]interface{}{} - for k, v := range toMap { - switch data := v.(type) { - case map[string]interface{}: - for mK, mV := range mapper(data) { - // Concatenate keys - res[fmt.Sprintf("%s.%s", k, mK)] = mV - } - // This is done to avoid skipping keys containing empty maps - if len(data) == 0 { - res[k] = map[string]interface{}{} - } - default: - res[k] = v - } +func (s *arduinoCoreServerImpl) SettingsSetValue(ctx context.Context, req *rpc.SettingsSetValueRequest) (*rpc.SettingsSetValueResponse, error) { + // Determine the existence and the kind of the value + key := req.GetKey() + defaultValue, ok := s.settings.Defaults.GetOk(key) + if !ok { + return nil, &cmderrors.InvalidArgumentError{Message: fmt.Sprintf("key %s not found", key)} } - return res -} + expectedType := reflect.TypeOf(defaultValue) -// SettingsMerge applies multiple settings values at once. -func (s *arduinoCoreServerImpl) SettingsMerge(ctx context.Context, req *rpc.SettingsMergeRequest) (*rpc.SettingsMergeResponse, error) { - var toMerge map[string]interface{} - if err := json.Unmarshal([]byte(req.GetJsonData()), &toMerge); err != nil { - return nil, err + // Extract the value from the request + var newValue any + if err := json.Unmarshal([]byte(req.GetValueJson()), &newValue); err != nil { + return nil, &cmderrors.InvalidArgumentError{Message: fmt.Sprintf("invalid value: %v", err)} } + newValueType := reflect.TypeOf(newValue) - mapped := mapper(toMerge) - - // Set each value individually. - // This is done because Viper ignores empty strings or maps when - // using the MergeConfigMap function. - updatedSettings := configuration.Init("") - for k, v := range mapped { - updatedSettings.Set(k, v) + // Check if the value is of the same type of the default value + if newValueType != expectedType { + return nil, &cmderrors.InvalidArgumentError{Message: fmt.Sprintf("value type mismatch: expected %T, got %T", defaultValue, newValue)} } - configPath := s.settings.ConfigFileUsed() - updatedSettings.SetConfigFile(configPath) - s.settings = updatedSettings - return &rpc.SettingsMergeResponse{}, nil + // Set the value + s.settings.Set(key, newValue) + return &rpc.SettingsSetValueResponse{}, nil } -// SettingsGetValue returns a settings value given its key. If the key is not present -// an error will be returned, so that we distinguish empty settings from missing -// ones. func (s *arduinoCoreServerImpl) SettingsGetValue(ctx context.Context, req *rpc.SettingsGetValueRequest) (*rpc.SettingsGetValueResponse, error) { key := req.GetKey() - - // Check if settings key actually existing, we don't use Viper.InConfig() - // since that doesn't check for keys formatted like daemon.port or those set - // with Viper.Set(). This way we check for all existing settings for sure. - keyExists := false - for _, k := range s.settings.AllKeys() { - if k == key || strings.HasPrefix(k, key) { - keyExists = true - break - } + value, ok := s.settings.GetOk(key) + if !ok { + value, ok = s.settings.Defaults.GetOk(key) } - if !keyExists { - return nil, errors.New(tr("key not found in settings")) + if !ok { + return nil, &cmderrors.InvalidArgumentError{Message: fmt.Sprintf("key %s not found", key)} } - - b, err := json.Marshal(s.settings.Get(key)) - value := &rpc.SettingsGetValueResponse{} - if err == nil { - value.Key = key - value.JsonData = string(b) + valueJson, err := json.Marshal(value) + if err != nil { + return nil, fmt.Errorf("error marshalling value: %v", err) } - - return value, err + return &rpc.SettingsGetValueResponse{ + ValueJson: string(valueJson), + }, nil } -// SettingsSetValue updates or set a value for a certain key. -func (s *arduinoCoreServerImpl) SettingsSetValue(ctx context.Context, val *rpc.SettingsSetValueRequest) (*rpc.SettingsSetValueResponse, error) { - key := val.GetKey() - var value interface{} - - err := json.Unmarshal([]byte(val.GetJsonData()), &value) - if err == nil { - s.settings.Set(key, value) - } - - return &rpc.SettingsSetValueResponse{}, err +// ConfigurationSave encodes the current configuration in the specified format +func (s *arduinoCoreServerImpl) ConfigurationSave(ctx context.Context, req *rpc.ConfigurationSaveRequest) (*rpc.ConfigurationSaveResponse, error) { + // TODO + return &rpc.ConfigurationSaveResponse{}, nil } -// SettingsWrite to file set in request the settings currently stored in memory. -// We don't have a Read() function, that's not necessary since we only want one config file to be used -// and that's picked up when the CLI is run as daemon, either using the default path or a custom one -// set with the --config-file flag. -func (s *arduinoCoreServerImpl) SettingsWrite(ctx context.Context, req *rpc.SettingsWriteRequest) (*rpc.SettingsWriteResponse, error) { - if err := s.settings.WriteConfigAs(req.GetFilePath()); err != nil { - return nil, err - } - return &rpc.SettingsWriteResponse{}, nil +// SettingsReadFromFile read settings from a YAML file and replace the settings currently stored in memory. +func (s *arduinoCoreServerImpl) ConfigurationOpen(ctx context.Context, req *rpc.ConfigurationOpenRequest) (*rpc.ConfigurationOpenResponse, error) { + // TODO + return &rpc.ConfigurationOpenResponse{}, nil } -// SettingsDelete removes a key from the config file -func (s *arduinoCoreServerImpl) SettingsDelete(ctx context.Context, req *rpc.SettingsDeleteRequest) (*rpc.SettingsDeleteResponse, error) { - toDelete := req.GetKey() - - // Check if settings key actually existing, we don't use Viper.InConfig() - // since that doesn't check for keys formatted like daemon.port or those set - // with Viper.Set(). This way we check for all existing settings for sure. - keyExists := false - keys := []string{} - for _, k := range s.settings.AllKeys() { - if !strings.HasPrefix(k, toDelete) { - keys = append(keys, k) - continue - } - keyExists = true - } - - if !keyExists { - return nil, errors.New(tr("key not found in settings")) +// SettingsEnumerate returns the list of all the settings keys. +func (s *arduinoCoreServerImpl) SettingsEnumerate(ctx context.Context, req *rpc.SettingsEnumerateRequest) (*rpc.SettingsEnumerateResponse, error) { + var entries []*rpc.SettingsEnumerateResponse_Entry + for _, k := range s.settings.Defaults.AllKeys() { + v := s.settings.Defaults.Get(k) + entries = append(entries, &rpc.SettingsEnumerateResponse_Entry{ + Key: k, + Type: reflect.TypeOf(v).String(), + }) } - - // Override current settings to delete the key - updatedSettings := configuration.Init("") - for _, k := range keys { - updatedSettings.Set(k, s.settings.Get(k)) - } - configPath := s.settings.ConfigFileUsed() - updatedSettings.SetConfigFile(configPath) - s.settings = updatedSettings - - return &rpc.SettingsDeleteResponse{}, nil + return &rpc.SettingsEnumerateResponse{ + Entries: entries, + }, nil } diff --git a/commands/service_settings_test.go b/commands/service_settings_test.go index e1d67fb0fad..97c70d49197 100644 --- a/commands/service_settings_test.go +++ b/commands/service_settings_test.go @@ -15,180 +15,180 @@ package commands -import ( - "context" - "encoding/json" - "path/filepath" - "testing" - - "github.com/arduino/arduino-cli/internal/cli/configuration" - rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" - "github.com/arduino/go-paths-helper" - "github.com/stretchr/testify/require" -) - -func TestGetAll(t *testing.T) { - settings := configuration.Init(filepath.Join("testdata", "arduino-cli.yaml")) - svc := NewArduinoCoreServer("", settings) - resp, err := svc.SettingsGetAll(context.Background(), &rpc.SettingsGetAllRequest{}) - require.Nil(t, err) - - content, err := json.Marshal(settings.AllSettings()) - require.Nil(t, err) - - require.Equal(t, string(content), resp.GetJsonData()) -} - -func TestMerge(t *testing.T) { - initialSettings := configuration.Init(filepath.Join("testdata", "arduino-cli.yaml")) - svc := NewArduinoCoreServer("", initialSettings).(*arduinoCoreServerImpl) - ctx := context.Background() - - // Verify defaults - require.Equal(t, "50051", svc.settings.GetString("daemon.port")) - require.Equal(t, "", svc.settings.GetString("foo")) - require.Equal(t, false, svc.settings.GetBool("sketch.always_export_binaries")) - - bulkSettings := `{"foo": "bar", "daemon":{"port":"420"}, "sketch": {"always_export_binaries": "true"}}` - res, err := svc.SettingsMerge(ctx, &rpc.SettingsMergeRequest{JsonData: bulkSettings}) - require.NotNil(t, res) - require.NoError(t, err) - - require.Equal(t, "420", svc.settings.GetString("daemon.port")) - require.Equal(t, "bar", svc.settings.GetString("foo")) - require.Equal(t, true, svc.settings.GetBool("sketch.always_export_binaries")) - - bulkSettings = `{"foo":"", "daemon": {}, "sketch": {"always_export_binaries": "false"}}` - res, err = svc.SettingsMerge(ctx, &rpc.SettingsMergeRequest{JsonData: bulkSettings}) - require.NotNil(t, res) - require.NoError(t, err) - - require.Equal(t, "50051", svc.settings.GetString("daemon.port")) - require.Equal(t, "", svc.settings.GetString("foo")) - require.Equal(t, false, svc.settings.GetBool("sketch.always_export_binaries")) - - bulkSettings = `{"daemon": {"port":""}}` - res, err = svc.SettingsMerge(ctx, &rpc.SettingsMergeRequest{JsonData: bulkSettings}) - require.NotNil(t, res) - require.NoError(t, err) - - require.Equal(t, "", svc.settings.GetString("daemon.port")) - // Verifies other values are not changed - require.Equal(t, "", svc.settings.GetString("foo")) - require.Equal(t, false, svc.settings.GetBool("sketch.always_export_binaries")) - - bulkSettings = `{"network": {}}` - res, err = svc.SettingsMerge(ctx, &rpc.SettingsMergeRequest{JsonData: bulkSettings}) - require.NotNil(t, res) - require.NoError(t, err) - - require.Equal(t, "", svc.settings.GetString("proxy")) -} - -func TestGetValue(t *testing.T) { - settings := configuration.Init(filepath.Join("testdata", "arduino-cli.yaml")) - svc := NewArduinoCoreServer("", settings) - - key := &rpc.SettingsGetValueRequest{Key: "daemon"} - resp, err := svc.SettingsGetValue(context.Background(), key) - require.NoError(t, err) - require.Equal(t, `{"port":"50051"}`, resp.GetJsonData()) - - key = &rpc.SettingsGetValueRequest{Key: "daemon.port"} - resp, err = svc.SettingsGetValue(context.Background(), key) - require.NoError(t, err) - require.Equal(t, `"50051"`, resp.GetJsonData()) -} - -func TestGetMergedValue(t *testing.T) { - settings := configuration.Init(filepath.Join("testdata", "arduino-cli.yaml")) - svc := NewArduinoCoreServer("", settings) - - // Verifies value is not set - key := &rpc.SettingsGetValueRequest{Key: "foo"} - res, err := svc.SettingsGetValue(context.Background(), key) - require.Nil(t, res) - require.Error(t, err, "Error getting settings value") - - // Merge value - bulkSettings := `{"foo": "bar"}` - _, err = svc.SettingsMerge(context.Background(), &rpc.SettingsMergeRequest{JsonData: bulkSettings}) - require.NoError(t, err) - - // Verifies value is correctly returned - key = &rpc.SettingsGetValueRequest{Key: "foo"} - res, err = svc.SettingsGetValue(context.Background(), key) - require.NoError(t, err) - require.Equal(t, `"bar"`, res.GetJsonData()) -} - -func TestGetValueNotFound(t *testing.T) { - settings := configuration.Init(filepath.Join("testdata", "arduino-cli.yaml")) - svc := NewArduinoCoreServer("", settings) - - key := &rpc.SettingsGetValueRequest{Key: "DOESNTEXIST"} - _, err := svc.SettingsGetValue(context.Background(), key) - require.Error(t, err) -} - -func TestSetValue(t *testing.T) { - settings := configuration.Init(filepath.Join("testdata", "arduino-cli.yaml")) - svc := NewArduinoCoreServer("", settings) - - val := &rpc.SettingsSetValueRequest{ - Key: "foo", - JsonData: `"bar"`, - } - _, err := svc.SettingsSetValue(context.Background(), val) - require.Nil(t, err) - require.Equal(t, "bar", settings.GetString("foo")) -} - -func TestWrite(t *testing.T) { - settings := configuration.Init(filepath.Join("testdata", "arduino-cli.yaml")) - svc := NewArduinoCoreServer("", settings) - - // Writes some settings - val := &rpc.SettingsSetValueRequest{ - Key: "foo", - JsonData: `"bar"`, - } - _, err := svc.SettingsSetValue(context.Background(), val) - require.NoError(t, err) - - tempDir := paths.TempDir() - testFolder, err := tempDir.MkTempDir("testdata") - require.NoError(t, err) - defer testFolder.RemoveAll() - - // Verifies config files doesn't exist - configFile := testFolder.Join("arduino-cli.yml") - require.True(t, configFile.NotExist()) - - _, err = svc.SettingsWrite(context.Background(), &rpc.SettingsWriteRequest{ - FilePath: configFile.String(), - }) - require.NoError(t, err) - - // Verifies config file is created. - // We don't verify the content since we expect config library, Viper, to work - require.True(t, configFile.Exist()) -} - -func TestDelete(t *testing.T) { - settings := configuration.Init(filepath.Join("testdata", "arduino-cli.yaml")) - svc := NewArduinoCoreServer("", settings) - - _, err := svc.SettingsDelete(context.Background(), &rpc.SettingsDeleteRequest{ - Key: "doesnotexist", - }) - require.Error(t, err) - - _, err = svc.SettingsDelete(context.Background(), &rpc.SettingsDeleteRequest{ - Key: "network", - }) - require.NoError(t, err) - - _, err = svc.SettingsGetValue(context.Background(), &rpc.SettingsGetValueRequest{Key: "network"}) - require.Error(t, err) -} +// import ( +// "context" +// "encoding/json" +// "path/filepath" +// "testing" + +// "github.com/arduino/arduino-cli/internal/cli/configuration" +// rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" +// "github.com/arduino/go-paths-helper" +// "github.com/stretchr/testify/require" +// ) + +// func TestGetAll(t *testing.T) { +// settings := configuration.Init(filepath.Join("testdata", "arduino-cli.yaml")) +// svc := NewArduinoCoreServer("", settings) +// resp, err := svc.SettingsGetAll(context.Background(), &rpc.SettingsGetAllRequest{}) +// require.Nil(t, err) + +// content, err := json.Marshal(settings.AllSettings()) +// require.Nil(t, err) + +// require.Equal(t, string(content), resp.GetJsonData()) +// } + +// func TestMerge(t *testing.T) { +// initialSettings := configuration.Init(filepath.Join("testdata", "arduino-cli.yaml")) +// svc := NewArduinoCoreServer("", initialSettings).(*arduinoCoreServerImpl) +// ctx := context.Background() + +// // Verify defaults +// require.Equal(t, "50051", svc.settings.GetString("daemon.port")) +// require.Equal(t, "", svc.settings.GetString("foo")) +// require.Equal(t, false, svc.settings.GetBool("sketch.always_export_binaries")) + +// bulkSettings := `{"foo": "bar", "daemon":{"port":"420"}, "sketch": {"always_export_binaries": "true"}}` +// res, err := svc.SettingsMerge(ctx, &rpc.SettingsMergeRequest{JsonData: bulkSettings}) +// require.NotNil(t, res) +// require.NoError(t, err) + +// require.Equal(t, "420", svc.settings.GetString("daemon.port")) +// require.Equal(t, "bar", svc.settings.GetString("foo")) +// require.Equal(t, true, svc.settings.GetBool("sketch.always_export_binaries")) + +// bulkSettings = `{"foo":"", "daemon": {}, "sketch": {"always_export_binaries": "false"}}` +// res, err = svc.SettingsMerge(ctx, &rpc.SettingsMergeRequest{JsonData: bulkSettings}) +// require.NotNil(t, res) +// require.NoError(t, err) + +// require.Equal(t, "50051", svc.settings.GetString("daemon.port")) +// require.Equal(t, "", svc.settings.GetString("foo")) +// require.Equal(t, false, svc.settings.GetBool("sketch.always_export_binaries")) + +// bulkSettings = `{"daemon": {"port":""}}` +// res, err = svc.SettingsMerge(ctx, &rpc.SettingsMergeRequest{JsonData: bulkSettings}) +// require.NotNil(t, res) +// require.NoError(t, err) + +// require.Equal(t, "", svc.settings.GetString("daemon.port")) +// // Verifies other values are not changed +// require.Equal(t, "", svc.settings.GetString("foo")) +// require.Equal(t, false, svc.settings.GetBool("sketch.always_export_binaries")) + +// bulkSettings = `{"network": {}}` +// res, err = svc.SettingsMerge(ctx, &rpc.SettingsMergeRequest{JsonData: bulkSettings}) +// require.NotNil(t, res) +// require.NoError(t, err) + +// require.Equal(t, "", svc.settings.GetString("proxy")) +// } + +// func TestGetValue(t *testing.T) { +// settings := configuration.Init(filepath.Join("testdata", "arduino-cli.yaml")) +// svc := NewArduinoCoreServer("", settings) + +// key := &rpc.SettingsGetValueRequest{Key: "daemon"} +// resp, err := svc.SettingsGetValue(context.Background(), key) +// require.NoError(t, err) +// require.Equal(t, `{"port":"50051"}`, resp.GetJsonData()) + +// key = &rpc.SettingsGetValueRequest{Key: "daemon.port"} +// resp, err = svc.SettingsGetValue(context.Background(), key) +// require.NoError(t, err) +// require.Equal(t, `"50051"`, resp.GetJsonData()) +// } + +// func TestGetMergedValue(t *testing.T) { +// settings := configuration.Init(filepath.Join("testdata", "arduino-cli.yaml")) +// svc := NewArduinoCoreServer("", settings) + +// // Verifies value is not set +// key := &rpc.SettingsGetValueRequest{Key: "foo"} +// res, err := svc.SettingsGetValue(context.Background(), key) +// require.Nil(t, res) +// require.Error(t, err, "Error getting settings value") + +// // Merge value +// bulkSettings := `{"foo": "bar"}` +// _, err = svc.SettingsMerge(context.Background(), &rpc.SettingsMergeRequest{JsonData: bulkSettings}) +// require.NoError(t, err) + +// // Verifies value is correctly returned +// key = &rpc.SettingsGetValueRequest{Key: "foo"} +// res, err = svc.SettingsGetValue(context.Background(), key) +// require.NoError(t, err) +// require.Equal(t, `"bar"`, res.GetJsonData()) +// } + +// func TestGetValueNotFound(t *testing.T) { +// settings := configuration.Init(filepath.Join("testdata", "arduino-cli.yaml")) +// svc := NewArduinoCoreServer("", settings) + +// key := &rpc.SettingsGetValueRequest{Key: "DOESNTEXIST"} +// _, err := svc.SettingsGetValue(context.Background(), key) +// require.Error(t, err) +// } + +// func TestSetValue(t *testing.T) { +// settings := configuration.Init(filepath.Join("testdata", "arduino-cli.yaml")) +// svc := NewArduinoCoreServer("", settings) + +// val := &rpc.SettingsSetValueRequest{ +// Key: "foo", +// JsonData: `"bar"`, +// } +// _, err := svc.SettingsSetValue(context.Background(), val) +// require.Nil(t, err) +// require.Equal(t, "bar", settings.GetString("foo")) +// } + +// func TestWrite(t *testing.T) { +// settings := configuration.Init(filepath.Join("testdata", "arduino-cli.yaml")) +// svc := NewArduinoCoreServer("", settings) + +// // Writes some settings +// val := &rpc.SettingsSetValueRequest{ +// Key: "foo", +// JsonData: `"bar"`, +// } +// _, err := svc.SettingsSetValue(context.Background(), val) +// require.NoError(t, err) + +// tempDir := paths.TempDir() +// testFolder, err := tempDir.MkTempDir("testdata") +// require.NoError(t, err) +// defer testFolder.RemoveAll() + +// // Verifies config files doesn't exist +// configFile := testFolder.Join("arduino-cli.yml") +// require.True(t, configFile.NotExist()) + +// _, err = svc.SettingsWrite(context.Background(), &rpc.SettingsWriteRequest{ +// FilePath: configFile.String(), +// }) +// require.NoError(t, err) + +// // Verifies config file is created. +// // We don't verify the content since we expect config library, Viper, to work +// require.True(t, configFile.Exist()) +// } + +// func TestDelete(t *testing.T) { +// settings := configuration.Init(filepath.Join("testdata", "arduino-cli.yaml")) +// svc := NewArduinoCoreServer("", settings) + +// _, err := svc.SettingsDelete(context.Background(), &rpc.SettingsDeleteRequest{ +// Key: "doesnotexist", +// }) +// require.Error(t, err) + +// _, err = svc.SettingsDelete(context.Background(), &rpc.SettingsDeleteRequest{ +// Key: "network", +// }) +// require.NoError(t, err) + +// _, err = svc.SettingsGetValue(context.Background(), &rpc.SettingsGetValueRequest{Key: "network"}) +// require.Error(t, err) +// } diff --git a/commands/service_sketch_load_test.go b/commands/service_sketch_load_test.go index 822dfea7c5d..d7dfcdcf8fa 100644 --- a/commands/service_sketch_load_test.go +++ b/commands/service_sketch_load_test.go @@ -19,13 +19,12 @@ import ( "context" "testing" - "github.com/arduino/arduino-cli/internal/cli/configuration" "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" "github.com/stretchr/testify/require" ) func TestLoadSketchProfiles(t *testing.T) { - srv := NewArduinoCoreServer("", configuration.Init("")) + srv := NewArduinoCoreServer() loadResp, err := srv.LoadSketch(context.Background(), &commands.LoadSketchRequest{ SketchPath: "./testdata/sketch_with_profile", }) diff --git a/commands/service_sketch_new_test.go b/commands/service_sketch_new_test.go index 353dec17a05..8dfb5a8168e 100644 --- a/commands/service_sketch_new_test.go +++ b/commands/service_sketch_new_test.go @@ -20,7 +20,6 @@ import ( "fmt" "testing" - "github.com/arduino/arduino-cli/internal/cli/configuration" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" "github.com/stretchr/testify/require" ) @@ -36,7 +35,7 @@ func Test_SketchNameWrongPattern(t *testing.T) { ",`hack[}attempt{];", } - srv := NewArduinoCoreServer("", configuration.Init("")) + srv := NewArduinoCoreServer() for _, name := range invalidNames { _, err := srv.NewSketch(context.Background(), &rpc.NewSketchRequest{ SketchName: name, @@ -49,7 +48,7 @@ func Test_SketchNameWrongPattern(t *testing.T) { } func Test_SketchNameEmpty(t *testing.T) { - srv := NewArduinoCoreServer("", configuration.Init("")) + srv := NewArduinoCoreServer() _, err := srv.NewSketch(context.Background(), &rpc.NewSketchRequest{ SketchName: "", SketchDir: t.TempDir(), @@ -63,7 +62,7 @@ func Test_SketchNameTooLong(t *testing.T) { for i := range tooLongName { tooLongName[i] = 'a' } - srv := NewArduinoCoreServer("", configuration.Init("")) + srv := NewArduinoCoreServer() _, err := srv.NewSketch(context.Background(), &rpc.NewSketchRequest{ SketchName: string(tooLongName), SketchDir: t.TempDir(), @@ -87,7 +86,7 @@ func Test_SketchNameOk(t *testing.T) { "_hello_world", string(lengthLimitName), } - srv := NewArduinoCoreServer("", configuration.Init("")) + srv := NewArduinoCoreServer() for _, name := range validNames { _, err := srv.NewSketch(context.Background(), &rpc.NewSketchRequest{ SketchName: name, @@ -100,7 +99,7 @@ func Test_SketchNameOk(t *testing.T) { func Test_SketchNameReserved(t *testing.T) { invalidNames := []string{"CON", "PRN", "AUX", "NUL", "COM0", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", "LPT0", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9"} - srv := NewArduinoCoreServer("", configuration.Init("")) + srv := NewArduinoCoreServer() for _, name := range invalidNames { _, err := srv.NewSketch(context.Background(), &rpc.NewSketchRequest{ SketchName: name, diff --git a/go.mod b/go.mod index 13185198605..7b48c0b4280 100644 --- a/go.mod +++ b/go.mod @@ -1,10 +1,12 @@ module github.com/arduino/arduino-cli -go 1.21 +go 1.21.1 // We must use this fork until https://github.com/mailru/easyjson/pull/372 is merged replace github.com/mailru/easyjson => github.com/cmaglie/easyjson v0.8.1 +replace go.bug.st/configmap => ../go-configmap + require ( github.com/ProtonMail/go-crypto v1.1.0-alpha.0 github.com/arduino/go-paths-helper v1.12.0 @@ -35,6 +37,7 @@ require ( github.com/stretchr/testify v1.9.0 github.com/xeipuuv/gojsonschema v1.2.0 go.bug.st/cleanup v1.0.0 + go.bug.st/configmap v0.0.1 go.bug.st/downloader/v2 v2.1.1 go.bug.st/relaxed-semver v0.12.0 go.bug.st/testifyjson v1.1.1 diff --git a/internal/arduino/cores/packagemanager/loader.go b/internal/arduino/cores/packagemanager/loader.go index 29e8fb511a4..f703b39632f 100644 --- a/internal/arduino/cores/packagemanager/loader.go +++ b/internal/arduino/cores/packagemanager/loader.go @@ -32,7 +32,7 @@ import ( // LoadHardware read all plaforms from the configured paths func (pm *Builder) LoadHardware(settings *configuration.Settings) []error { - hardwareDirs := configuration.HardwareDirectories(settings) + hardwareDirs := settings.HardwareDirectories() return pm.LoadHardwareFromDirectories(hardwareDirs) } diff --git a/internal/arduino/cores/packagemanager/package_manager_test.go b/internal/arduino/cores/packagemanager/package_manager_test.go index fb215816d0c..c6931ea63a2 100644 --- a/internal/arduino/cores/packagemanager/package_manager_test.go +++ b/internal/arduino/cores/packagemanager/package_manager_test.go @@ -24,7 +24,6 @@ import ( "testing" "github.com/arduino/arduino-cli/internal/arduino/cores" - "github.com/arduino/arduino-cli/internal/cli/configuration" "github.com/arduino/go-paths-helper" "github.com/arduino/go-properties-orderedmap" "github.com/stretchr/testify/require" @@ -433,11 +432,10 @@ func TestBoardOrdering(t *testing.T) { func TestFindToolsRequiredForBoard(t *testing.T) { t.Setenv("ARDUINO_DATA_DIR", dataDir1.String()) - settings := configuration.Init("") pmb := NewBuilder( dataDir1, - configuration.PackagesDir(settings), - configuration.DownloadsDir(settings), + dataDir1.Join("packages"), + dataDir1.Join("staging"), dataDir1, "test", downloader.GetDefaultConfig(), diff --git a/internal/arduino/cores/packagemanager/profiles.go b/internal/arduino/cores/packagemanager/profiles.go index 6cd6f3578d2..c9560f1ec98 100644 --- a/internal/arduino/cores/packagemanager/profiles.go +++ b/internal/arduino/cores/packagemanager/profiles.go @@ -74,7 +74,7 @@ func (pmb *Builder) loadProfilePlatform(platformRef *sketch.ProfilePlatformRefer release := platform.GetOrCreateRelease(platformRef.Version) uid := platformRef.InternalUniqueIdentifier() - destDir := configuration.ProfilesCacheDir(settings).Join(uid) + destDir := settings.ProfilesCacheDir().Join(uid) if !destDir.IsDir() && installMissing { // Try installing the missing platform if err := pmb.installMissingProfilePlatform(platformRef, destDir, downloadCB, taskCB); err != nil { @@ -142,7 +142,7 @@ func (pmb *Builder) loadProfileTool(toolRef *cores.ToolDependency, indexURL *url tool := targetPackage.GetOrCreateTool(toolRef.ToolName) uid := toolRef.InternalUniqueIdentifier(indexURL) - destDir := configuration.ProfilesCacheDir(settings).Join(uid) + destDir := settings.ProfilesCacheDir().Join(uid) if !destDir.IsDir() && installMissing { // Try installing the missing tool diff --git a/internal/cli/arguments/reference_test.go b/internal/cli/arguments/reference_test.go index f91109f8de6..e55051cc768 100644 --- a/internal/cli/arguments/reference_test.go +++ b/internal/cli/arguments/reference_test.go @@ -21,7 +21,6 @@ import ( "github.com/arduino/arduino-cli/commands" "github.com/arduino/arduino-cli/internal/cli/arguments" - "github.com/arduino/arduino-cli/internal/cli/configuration" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -55,7 +54,7 @@ func TestArgsStringify(t *testing.T) { } func TestParseReferenceCores(t *testing.T) { - srv := commands.NewArduinoCoreServer("", configuration.Init("")) + srv := commands.NewArduinoCoreServer() ctx := context.Background() for _, tt := range goodCores { actual, err := arguments.ParseReference(ctx, srv, tt.in) @@ -76,7 +75,7 @@ func TestParseArgs(t *testing.T) { input = append(input, tt.in) } - srv := commands.NewArduinoCoreServer("", configuration.Init("")) + srv := commands.NewArduinoCoreServer() refs, err := arguments.ParseReferences(context.Background(), srv, input) assert.Nil(t, err) assert.Equal(t, len(goodCores), len(refs)) diff --git a/internal/cli/cache/clean.go b/internal/cli/cache/clean.go index 4859676ae1c..a55b9c8309b 100644 --- a/internal/cli/cache/clean.go +++ b/internal/cli/cache/clean.go @@ -29,7 +29,7 @@ func initCleanCommand(srv rpc.ArduinoCoreServiceServer) *cobra.Command { cleanCommand := &cobra.Command{ Use: "clean", Short: tr("Delete Boards/Library Manager download cache."), - Long: tr("Delete contents of the `directories.downloads` folder, where archive files are staged during installation of libraries and boards platforms."), + Long: tr("Delete contents of the downloads cache folder, where archive files are staged during installation of libraries and boards platforms."), Example: " " + os.Args[0] + " cache clean", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { diff --git a/internal/cli/cli.go b/internal/cli/cli.go index 347ebb6c2dc..b591a1c17df 100644 --- a/internal/cli/cli.go +++ b/internal/cli/cli.go @@ -17,6 +17,7 @@ package cli import ( "context" + "encoding/json" "fmt" "io" "os" @@ -28,7 +29,6 @@ import ( "github.com/arduino/arduino-cli/internal/cli/compile" "github.com/arduino/arduino-cli/internal/cli/completion" "github.com/arduino/arduino-cli/internal/cli/config" - "github.com/arduino/arduino-cli/internal/cli/configuration" "github.com/arduino/arduino-cli/internal/cli/core" "github.com/arduino/arduino-cli/internal/cli/daemon" "github.com/arduino/arduino-cli/internal/cli/debug" @@ -55,26 +55,63 @@ import ( semver "go.bug.st/relaxed-semver" ) -var ( - verbose bool - outputFormat string - configFile string -) - // NewCommand creates a new ArduinoCli command root -func NewCommand(srv rpc.ArduinoCoreServiceServer, defaultSettings *configuration.Settings) *cobra.Command { +func NewCommand(srv rpc.ArduinoCoreServiceServer, settings *rpc.Configuration) *cobra.Command { cobra.AddTemplateFunc("tr", i18n.Tr) var updaterMessageChan chan *semver.Version - // ArduinoCli is the root command + var ( + verbose bool + noColor bool + logLevel string + logFile string + logFormat string + outputFormat string + configFile string + additionalUrls []string + ) + + defaultLogFile := settings.GetLogging().GetFile() + defaultLogFormat := settings.GetLogging().GetFormat() + defaultAdditionalURLs := settings.GetBoardManager().GetAdditionalUrls() + defaultOutputNoColor := settings.GetOutput().GetNoColor() + cmd := &cobra.Command{ Use: "arduino-cli", Short: tr("Arduino CLI."), Long: tr("Arduino Command Line Interface (arduino-cli)."), Example: fmt.Sprintf(" %s <%s> [%s...]", os.Args[0], tr("command"), tr("flags")), PersistentPreRun: func(cmd *cobra.Command, args []string) { - preRun(cmd, defaultSettings) + ctx := cmd.Context() + + // Override server settings with the flags from the command line + set := func(key string, value any) { + if valueJson, err := json.Marshal(value); err != nil { + feedback.Fatal(tr("Error setting value: %v", err), feedback.ErrGeneric) + } else if _, err := srv.SettingsSetValue(ctx, &rpc.SettingsSetValueRequest{Key: key, ValueJson: string(valueJson)}); err != nil { + feedback.Fatal(tr("Error setting value: %v", err), feedback.ErrGeneric) + } + } + set("logging.level", logLevel) + set("logging.file", logFile) + set("board_manager.additional_urls", additionalUrls) + set("output.no_color", noColor) + + if outputFormat != "text" { + cmd.SetHelpFunc(func(cmd *cobra.Command, args []string) { + feedback.Fatal(tr("Should show help message, but it is available only in TEXT mode."), feedback.ErrBadArgument) + }) + } + + preRun(verbose, outputFormat, logLevel, logFile, logFormat, noColor, settings) + + // Log the configuration file used + if configFile := ctx.Value("config_file").(string); configFile != "" { + logrus.Infof("Using config file: %s", configFile) + } else { + logrus.Info("Config file not found, using default values") + } if cmd.Name() != "version" { updaterMessageChan = make(chan *semver.Version) @@ -110,13 +147,13 @@ func NewCommand(srv rpc.ArduinoCoreServiceServer, defaultSettings *configuration cmd.AddCommand(board.NewCommand(srv)) cmd.AddCommand(cache.NewCommand(srv)) - cmd.AddCommand(compile.NewCommand(srv, defaultSettings)) + cmd.AddCommand(compile.NewCommand(srv, settings)) cmd.AddCommand(completion.NewCommand()) - cmd.AddCommand(config.NewCommand(srv, defaultSettings)) + cmd.AddCommand(config.NewCommand(srv, settings)) cmd.AddCommand(core.NewCommand(srv)) - cmd.AddCommand(daemon.NewCommand(srv, defaultSettings)) + cmd.AddCommand(daemon.NewCommand(srv, settings)) cmd.AddCommand(generatedocs.NewCommand()) - cmd.AddCommand(lib.NewCommand(srv, defaultSettings)) + cmd.AddCommand(lib.NewCommand(srv, settings)) cmd.AddCommand(monitor.NewCommand(srv)) cmd.AddCommand(outdated.NewCommand(srv)) cmd.AddCommand(sketch.NewCommand(srv)) @@ -127,29 +164,24 @@ func NewCommand(srv rpc.ArduinoCoreServiceServer, defaultSettings *configuration cmd.AddCommand(burnbootloader.NewCommand(srv)) cmd.AddCommand(version.NewCommand(srv)) cmd.AddCommand(feedback.NewCommand()) + cmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, tr("Print the logs on the standard output.")) cmd.Flag("verbose").Hidden = true cmd.PersistentFlags().BoolVar(&verbose, "log", false, tr("Print the logs on the standard output.")) + defaultLogLevel := settings.GetLogging().GetLevel() validLogLevels := []string{"trace", "debug", "info", "warn", "error", "fatal", "panic"} - cmd.PersistentFlags().String("log-level", "", tr("Messages with this level and above will be logged. Valid levels are: %s", strings.Join(validLogLevels, ", "))) - cmd.RegisterFlagCompletionFunc("log-level", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return validLogLevels, cobra.ShellCompDirectiveDefault - }) - cmd.PersistentFlags().String("log-file", "", tr("Path to the file where logs will be written.")) + cmd.PersistentFlags().StringVar(&logLevel, "log-level", defaultLogLevel, tr("Messages with this level and above will be logged. Valid levels are: %s", strings.Join(validLogLevels, ", "))) + cmd.RegisterFlagCompletionFunc("log-level", cobra.FixedCompletions(validLogLevels, cobra.ShellCompDirectiveDefault)) + cmd.PersistentFlags().StringVar(&logFile, "log-file", defaultLogFile, tr("Path to the file where logs will be written.")) validLogFormats := []string{"text", "json"} - cmd.PersistentFlags().String("log-format", "", tr("The output format for the logs, can be: %s", strings.Join(validLogFormats, ", "))) - cmd.RegisterFlagCompletionFunc("log-format", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return validLogFormats, cobra.ShellCompDirectiveDefault - }) + cmd.PersistentFlags().StringVar(&logFormat, "log-format", defaultLogFormat, tr("The output format for the logs, can be: %s", strings.Join(validLogFormats, ", "))) + cmd.RegisterFlagCompletionFunc("log-format", cobra.FixedCompletions(validLogFormats, cobra.ShellCompDirectiveDefault)) validOutputFormats := []string{"text", "json", "jsonmini", "yaml"} cmd.PersistentFlags().StringVar(&outputFormat, "format", "text", tr("The output format for the logs, can be: %s", strings.Join(validOutputFormats, ", "))) - cmd.RegisterFlagCompletionFunc("format", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return validOutputFormats, cobra.ShellCompDirectiveDefault - }) + cmd.RegisterFlagCompletionFunc("format", cobra.FixedCompletions(validOutputFormats, cobra.ShellCompDirectiveDefault)) cmd.PersistentFlags().StringVar(&configFile, "config-file", "", tr("The custom config file (if not specified the default will be used).")) - cmd.PersistentFlags().StringSlice("additional-urls", []string{}, tr("Comma-separated list of additional URLs for the Boards Manager.")) - cmd.PersistentFlags().Bool("no-color", false, "Disable colored output.") - configuration.BindFlags(cmd, defaultSettings) + cmd.PersistentFlags().StringSliceVar(&additionalUrls, "additional-urls", defaultAdditionalURLs, tr("Comma-separated list of additional URLs for the Boards Manager.")) + cmd.PersistentFlags().BoolVar(&noColor, "no-color", defaultOutputNoColor, "Disable colored output.") return cmd } @@ -170,17 +202,15 @@ func toLogLevel(s string) (t logrus.Level, found bool) { return } -func preRun(cmd *cobra.Command, defaultSettings *configuration.Settings) { - configFile := defaultSettings.ConfigFileUsed() - +func preRun(verbose bool, outputFormat string, logLevel, logFile, logFormat string, noColor bool, settings *rpc.Configuration) { // initialize inventory - err := inventory.Init(configuration.DataDir(defaultSettings).String()) + err := inventory.Init(settings.GetDirectories().GetData()) if err != nil { feedback.Fatal(fmt.Sprintf("Error: %v", err), feedback.ErrInitializingInventory) } // https://no-color.org/ - color.NoColor = defaultSettings.GetBool("output.no_color") || os.Getenv("NO_COLOR") != "" + color.NoColor = noColor || os.Getenv("NO_COLOR") != "" // Set default feedback output to colorable feedback.SetOut(colorable.NewColorableStdout()) @@ -203,13 +233,12 @@ func preRun(cmd *cobra.Command, defaultSettings *configuration.Settings) { } // set the Logger format - logFormat := strings.ToLower(defaultSettings.GetString("logging.format")) + logFormat = strings.ToLower(logFormat) if logFormat == "json" { logrus.SetFormatter(&logrus.JSONFormatter{}) } // should we log to file? - logFile := defaultSettings.GetString("logging.file") if logFile != "" { file, err := os.OpenFile(logFile, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666) if err != nil { @@ -225,41 +254,26 @@ func preRun(cmd *cobra.Command, defaultSettings *configuration.Settings) { } // configure logging filter - if lvl, found := toLogLevel(defaultSettings.GetString("logging.level")); !found { - feedback.Fatal(tr("Invalid option for --log-level: %s", defaultSettings.GetString("logging.level")), feedback.ErrBadArgument) + if logrusLevel, found := toLogLevel(logLevel); !found { + feedback.Fatal(tr("Invalid logging level: %s", logLevel), feedback.ErrBadArgument) } else { - logrus.SetLevel(lvl) + logrus.SetLevel(logrusLevel) } // // Prepare the Feedback system // - // check the right output format was passed - format, found := feedback.ParseOutputFormat(outputFormat) - if !found { + // use the output format to configure the Feedback + format, ok := feedback.ParseOutputFormat(outputFormat) + if !ok { feedback.Fatal(tr("Invalid output format: %s", outputFormat), feedback.ErrBadArgument) } - - // use the output format to configure the Feedback feedback.SetFormat(format) // // Print some status info and check command is consistent // - if configFile != "" { - logrus.Infof("Using config file: %s", configFile) - } else { - logrus.Info("Config file not found, using default values") - } - logrus.Info(versioninfo.VersionInfo.Application + " version " + versioninfo.VersionInfo.VersionString) - - if outputFormat != "text" { - cmd.SetHelpFunc(func(cmd *cobra.Command, args []string) { - logrus.Warn("Calling help on JSON format") - feedback.Fatal(tr("Invalid Call : should show Help, but it is available only in TEXT mode."), feedback.ErrBadArgument) - }) - } } diff --git a/internal/cli/compile/compile.go b/internal/cli/compile/compile.go index 290b5a4c649..4b4ad4164bd 100644 --- a/internal/cli/compile/compile.go +++ b/internal/cli/compile/compile.go @@ -27,7 +27,6 @@ import ( "github.com/arduino/arduino-cli/commands" "github.com/arduino/arduino-cli/commands/cmderrors" "github.com/arduino/arduino-cli/internal/cli/arguments" - "github.com/arduino/arduino-cli/internal/cli/configuration" "github.com/arduino/arduino-cli/internal/cli/feedback" "github.com/arduino/arduino-cli/internal/cli/feedback/result" "github.com/arduino/arduino-cli/internal/cli/feedback/table" @@ -58,7 +57,7 @@ var ( uploadAfterCompile bool // Upload the binary after the compilation. portArgs arguments.Port // Upload port, e.g.: COM10 or /dev/ttyACM0. verify bool // Upload, verify uploaded binary after the upload. - exportBinaries bool // + exportBinaries bool // If set built binaries will be exported to the sketch folder exportDir string // The compiled binary is written to this file optimizeForDebug bool // Optimize compile output for debug, not for release programmer arguments.Programmer // Use the specified programmer to upload @@ -77,7 +76,7 @@ var ( ) // NewCommand created a new `compile` command -func NewCommand(srv rpc.ArduinoCoreServiceServer, defaultSettings *configuration.Settings) *cobra.Command { +func NewCommand(srv rpc.ArduinoCoreServiceServer, settings *rpc.Configuration) *cobra.Command { compileCommand := &cobra.Command{ Use: "compile", Short: tr("Compiles Arduino sketches."), @@ -99,7 +98,7 @@ func NewCommand(srv rpc.ArduinoCoreServiceServer, defaultSettings *configuration showPropertiesArg.AddToCommand(compileCommand) compileCommand.Flags().BoolVar(&preprocess, "preprocess", false, tr("Print preprocessed code to stdout instead of compiling.")) compileCommand.Flags().StringVar(&buildCachePath, "build-cache-path", "", tr("Builds of 'core.a' are saved into this path to be cached and reused.")) - compileCommand.Flags().StringVarP(&exportDir, "output-dir", "", "", tr("Save build artifacts in this directory.")) + compileCommand.Flags().StringVar(&exportDir, "output-dir", "", tr("Save build artifacts in this directory.")) compileCommand.Flags().StringVar(&buildPath, "build-path", "", tr("Path where to save compiled files. If omitted, a directory will be created in the default temporary path of your OS.")) compileCommand.Flags().StringSliceVar(&buildProperties, "build-properties", []string{}, @@ -127,13 +126,13 @@ func NewCommand(srv rpc.ArduinoCoreServiceServer, defaultSettings *configuration programmer.AddToCommand(compileCommand, srv) compileCommand.Flags().BoolVar(&compilationDatabaseOnly, "only-compilation-database", false, tr("Just produce the compilation database, without actually compiling. All build commands are skipped except pre* hooks.")) compileCommand.Flags().BoolVar(&clean, "clean", false, tr("Optional, cleanup the build folder and do not use any cached build.")) - compileCommand.Flags().BoolVarP(&exportBinaries, "export-binaries", "e", false, tr("If set built binaries will be exported to the sketch folder.")) + compileCommand.Flags().BoolVarP(&exportBinaries, "export-binaries", "e", settings.GetSketch().GetAlwaysExportBinaries(), + tr("If set built binaries will be exported to the sketch folder.")) compileCommand.Flags().StringVar(&sourceOverrides, "source-override", "", tr("Optional. Path to a .json file that contains a set of replacements of the sketch source code.")) compileCommand.Flag("source-override").Hidden = true compileCommand.Flags().BoolVar(&skipLibrariesDiscovery, "skip-libraries-discovery", false, "Skip libraries discovery. This flag is provided only for use in language server and other, very specific, use cases. Do not use for normal compiles") compileCommand.Flag("skip-libraries-discovery").Hidden = true compileCommand.Flags().Int32VarP(&jobs, "jobs", "j", 0, tr("Max number of parallel compiles. If set to 0 the number of available CPUs cores will be used.")) - defaultSettings.BindPFlag("sketch.always_export_binaries", compileCommand.Flags().Lookup("export-binaries")) compileCommand.Flags().MarkDeprecated("build-properties", tr("please use --build-property instead.")) @@ -233,6 +232,7 @@ func runCompileCommand(cmd *cobra.Command, args []string, srv rpc.ArduinoCoreSer Warnings: warnings, Verbose: verbose, Quiet: quiet, + ExportBinaries: &exportBinaries, ExportDir: exportDir, Libraries: libraries, OptimizeForDebug: optimizeForDebug, diff --git a/internal/cli/config/add.go b/internal/cli/config/add.go index 5678e52e470..96a1a858b48 100644 --- a/internal/cli/config/add.go +++ b/internal/cli/config/add.go @@ -16,35 +16,18 @@ package config import ( + "context" + "encoding/json" "os" - "reflect" + "slices" - "github.com/arduino/arduino-cli/internal/cli/configuration" "github.com/arduino/arduino-cli/internal/cli/feedback" + rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) -func uniquify[T comparable](s []T) []T { - // use a map, which enforces unique keys - inResult := make(map[T]bool) - var result []T - // loop through input slice **in order**, - // to ensure output retains that order - // (except that it removes duplicates) - for i := 0; i < len(s); i++ { - // attempt to use the element as a key - if _, ok := inResult[s[i]]; !ok { - // if key didn't exist in map, - // add to map and append to result - inResult[s[i]] = true - result = append(result, s[i]) - } - } - return result -} - -func initAddCommand(defaultSettings *configuration.Settings) *cobra.Command { +func initAddCommand(srv rpc.ArduinoCoreServiceServer) *cobra.Command { addCommand := &cobra.Command{ Use: "add", Short: tr("Adds one or more values to a setting."), @@ -54,31 +37,44 @@ func initAddCommand(defaultSettings *configuration.Settings) *cobra.Command { " " + os.Args[0] + " config add board_manager.additional_urls https://example.com/package_example_index.json https://another-url.com/package_another_index.json\n", Args: cobra.MinimumNArgs(2), Run: func(cmd *cobra.Command, args []string) { - runAddCommand(args, defaultSettings) + ctx := cmd.Context() + runAddCommand(ctx, srv, args) }, ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return GetSlicesConfigurationKeys(defaultSettings), cobra.ShellCompDirectiveDefault + ctx := cmd.Context() + return getAllArraySettingsKeys(ctx, srv), cobra.ShellCompDirectiveDefault }, } return addCommand } -func runAddCommand(args []string, defaultSettings *configuration.Settings) { +func runAddCommand(ctx context.Context, srv rpc.ArduinoCoreServiceServer, args []string) { logrus.Info("Executing `arduino-cli config add`") key := args[0] - kind := validateKey(key) - if kind != reflect.Slice { + if !slices.Contains(getAllArraySettingsKeys(ctx, srv), key) { msg := tr("The key '%[1]v' is not a list of items, can't add to it.\nMaybe use '%[2]s'?", key, "config set") feedback.Fatal(msg, feedback.ErrGeneric) } - v := defaultSettings.GetStringSlice(key) - v = append(v, args[1:]...) - v = uniquify(v) - defaultSettings.Set(key, v) + var currentValues []string + if resp, err := srv.SettingsGetValue(ctx, &rpc.SettingsGetValueRequest{Key: key}); err != nil { + feedback.Fatal(tr("Cannot get the configuration key %[1]s: %[2]v", key, err), feedback.ErrGeneric) + } else if err := json.Unmarshal([]byte(resp.GetValueJson()), ¤tValues); err != nil { + feedback.Fatal(tr("Cannot get the configuration key %[1]s: %[2]v", key, err), feedback.ErrGeneric) + } - if err := defaultSettings.WriteConfig(); err != nil { - feedback.Fatal(tr("Can't write config file: %v", err), feedback.ErrGeneric) + for _, arg := range args[1:] { + if !slices.Contains(currentValues, arg) { + currentValues = append(currentValues, arg) + } + } + + if newValuesJSON, err := json.Marshal(currentValues); err != nil { + feedback.Fatal(tr("Cannot remove the configuration key %[1]s: %[2]v", key, err), feedback.ErrGeneric) + } else if _, err := srv.SettingsSetValue(ctx, &rpc.SettingsSetValueRequest{Key: key, ValueJson: string(newValuesJSON)}); err != nil { + feedback.Fatal(tr("Cannot remove the configuration key %[1]s: %[2]v", key, err), feedback.ErrGeneric) } + + saveConfiguration(ctx, srv) } diff --git a/internal/cli/config/config.go b/internal/cli/config/config.go index d8d4cbf5e46..8f11db6afa2 100644 --- a/internal/cli/config/config.go +++ b/internal/cli/config/config.go @@ -16,46 +16,64 @@ package config import ( + "context" "os" - "reflect" + "strings" - "github.com/arduino/arduino-cli/internal/cli/configuration" + f "github.com/arduino/arduino-cli/internal/algorithms" + "github.com/arduino/arduino-cli/internal/cli/feedback" "github.com/arduino/arduino-cli/internal/i18n" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" + "github.com/arduino/go-paths-helper" "github.com/spf13/cobra" ) var tr = i18n.Tr // NewCommand created a new `config` command -func NewCommand(srv rpc.ArduinoCoreServiceServer, defaultSettings *configuration.Settings) *cobra.Command { +func NewCommand(srv rpc.ArduinoCoreServiceServer, settings *rpc.Configuration) *cobra.Command { configCommand := &cobra.Command{ Use: "config", Short: tr("Arduino configuration commands."), Example: " " + os.Args[0] + " config init", } - configCommand.AddCommand(initAddCommand(defaultSettings)) - configCommand.AddCommand(initDeleteCommand(srv, defaultSettings)) - configCommand.AddCommand(initDumpCommand(defaultSettings)) - configCommand.AddCommand(initGetCommand(srv, defaultSettings)) - configCommand.AddCommand(initInitCommand(defaultSettings)) - configCommand.AddCommand(initRemoveCommand(defaultSettings)) - configCommand.AddCommand(initSetCommand(defaultSettings)) + configCommand.AddCommand(initAddCommand(srv)) + configCommand.AddCommand(initDeleteCommand(srv)) + configCommand.AddCommand(initDumpCommand(srv)) + configCommand.AddCommand(initGetCommand(srv)) + configCommand.AddCommand(initInitCommand(srv)) + configCommand.AddCommand(initRemoveCommand(srv)) + configCommand.AddCommand(initSetCommand(srv)) return configCommand } -// GetSlicesConfigurationKeys is an helper function useful to autocomplete. -// It returns a list of configuration keys which can be changed -func GetSlicesConfigurationKeys(settings *configuration.Settings) []string { - var res []string - keys := settings.AllKeys() - for _, key := range keys { - kind, _ := typeOf(key) - if kind == reflect.Slice { - res = append(res, key) - } +func getAllSettingsKeys(ctx context.Context, srv rpc.ArduinoCoreServiceServer) []string { + res, _ := srv.SettingsEnumerate(ctx, &rpc.SettingsEnumerateRequest{}) + allKeys := f.Map(res.GetEntries(), (*rpc.SettingsEnumerateResponse_Entry).GetKey) + return allKeys +} + +func getAllArraySettingsKeys(ctx context.Context, srv rpc.ArduinoCoreServiceServer) []string { + res, _ := srv.SettingsEnumerate(ctx, &rpc.SettingsEnumerateRequest{}) + arrayEntries := f.Filter(res.GetEntries(), func(e *rpc.SettingsEnumerateResponse_Entry) bool { + return strings.HasPrefix(e.GetType(), "[]") + }) + arrayKeys := f.Map(arrayEntries, (*rpc.SettingsEnumerateResponse_Entry).GetKey) + return arrayKeys +} + +func saveConfiguration(ctx context.Context, srv rpc.ArduinoCoreServiceServer) { + var outConfig []byte + if res, err := srv.ConfigurationSave(ctx, &rpc.ConfigurationSaveRequest{Format: "yaml"}); err != nil { + feedback.Fatal(tr("Error writing to file: %v", err), feedback.ErrGeneric) + } else { + outConfig = []byte(res.GetEncodedSettings()) + } + + configFile := ctx.Value("config_file").(string) + if err := paths.New(configFile).WriteFile(outConfig); err != nil { + feedback.Fatal(tr("Error writing to file: %v", err), feedback.ErrGeneric) } - return res } diff --git a/internal/cli/config/delete.go b/internal/cli/config/delete.go index 75b81563aed..1dc9d77aa8a 100644 --- a/internal/cli/config/delete.go +++ b/internal/cli/config/delete.go @@ -19,15 +19,13 @@ import ( "context" "os" - "github.com/arduino/arduino-cli/internal/cli/configuration" "github.com/arduino/arduino-cli/internal/cli/feedback" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) -func initDeleteCommand(srv rpc.ArduinoCoreServiceServer, defaultSettings *configuration.Settings) *cobra.Command { - configFile := defaultSettings.ConfigFileUsed() +func initDeleteCommand(srv rpc.ArduinoCoreServiceServer) *cobra.Command { deleteCommand := &cobra.Command{ Use: "delete", Short: tr("Deletes a settings key and all its sub keys."), @@ -37,26 +35,24 @@ func initDeleteCommand(srv rpc.ArduinoCoreServiceServer, defaultSettings *config " " + os.Args[0] + " config delete board_manager.additional_urls", Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { - runDeleteCommand(srv, args, configFile) + ctx := cmd.Context() + runDeleteCommand(ctx, srv, args) }, ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return defaultSettings.AllKeys(), cobra.ShellCompDirectiveDefault + ctx := cmd.Context() + return getAllSettingsKeys(ctx, srv), cobra.ShellCompDirectiveDefault }, } return deleteCommand } -func runDeleteCommand(srv rpc.ArduinoCoreServiceServer, args []string, configFile string) { +func runDeleteCommand(ctx context.Context, srv rpc.ArduinoCoreServiceServer, args []string) { logrus.Info("Executing `arduino-cli config delete`") - ctx := context.Background() - toDelete := args[0] - _, err := srv.SettingsDelete(ctx, &rpc.SettingsDeleteRequest{Key: toDelete}) - if err != nil { - feedback.Fatal(tr("Cannot delete the key %[1]s: %[2]v", toDelete, err), feedback.ErrGeneric) - } - _, err = srv.SettingsWrite(ctx, &rpc.SettingsWriteRequest{FilePath: configFile}) - if err != nil { - feedback.Fatal(tr("Cannot write the file %[1]s: %[2]v", configFile, err), feedback.ErrGeneric) + key := args[0] + if _, err := srv.SettingsSetValue(ctx, &rpc.SettingsSetValueRequest{Key: key, ValueJson: ""}); err != nil { + feedback.Fatal(tr("Cannot delete the key %[1]s: %[2]v", key, err), feedback.ErrGeneric) } + + saveConfiguration(ctx, srv) } diff --git a/internal/cli/config/dump.go b/internal/cli/config/dump.go index 695e5b11ce8..a9c664563dc 100644 --- a/internal/cli/config/dump.go +++ b/internal/cli/config/dump.go @@ -18,14 +18,13 @@ package config import ( "os" - "github.com/arduino/arduino-cli/internal/cli/configuration" "github.com/arduino/arduino-cli/internal/cli/feedback" + 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 initDumpCommand(defaultSettings *configuration.Settings) *cobra.Command { +func initDumpCommand(srv rpc.ArduinoCoreServiceServer) *cobra.Command { var dumpCommand = &cobra.Command{ Use: "dump", Short: tr("Prints the current configuration"), @@ -34,16 +33,46 @@ func initDumpCommand(defaultSettings *configuration.Settings) *cobra.Command { Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { logrus.Info("Executing `arduino-cli config dump`") - feedback.PrintResult(dumpResult{defaultSettings.AllSettings()}) + res := &rawResult{} + switch feedback.GetFormat() { + case feedback.JSON, feedback.MinifiedJSON: + resp, err := srv.ConfigurationSave(cmd.Context(), &rpc.ConfigurationSaveRequest{Format: "json"}) + if err != nil { + logrus.Fatalf("Error creating configuration: %v", err) + } + res.rawJSON = []byte(resp.GetEncodedSettings()) + case feedback.YAML, feedback.Text: + resp, err := srv.ConfigurationSave(cmd.Context(), &rpc.ConfigurationSaveRequest{Format: "yaml"}) + if err != nil { + logrus.Fatalf("Error creating configuration: %v", err) + } + res.rawYAML = []byte(resp.GetEncodedSettings()) + default: + logrus.Fatalf("Unsupported format: %v", feedback.GetFormat()) + } + feedback.PrintResult(dumpResult{Config: res}) }, } return dumpCommand } -// output from this command requires special formatting, let's create a dedicated -// feedback.Result implementation +type rawResult struct { + rawJSON []byte + rawYAML []byte +} + +func (r *rawResult) MarshalJSON() ([]byte, error) { + // it is already encoded in rawJSON field + return r.rawJSON, nil +} + +func (r *rawResult) MarshalYAML() (interface{}, error) { + // it is already encoded in rawYAML field + return r.rawYAML, nil +} + type dumpResult struct { - Config map[string]interface{} `json:"config"` + Config *rawResult } func (dr dumpResult) Data() interface{} { @@ -51,10 +80,6 @@ func (dr dumpResult) Data() interface{} { } func (dr dumpResult) String() string { - bs, err := yaml.Marshal(dr.Config) - if err != nil { - // Should never happen - panic(tr("unable to marshal config to YAML: %v", err)) - } - return string(bs) + // In case of text output do not wrap the output in outer JSON or YAML structure + return string(dr.Config.rawYAML) } diff --git a/internal/cli/config/get.go b/internal/cli/config/get.go index dec61be03a7..c90169359d5 100644 --- a/internal/cli/config/get.go +++ b/internal/cli/config/get.go @@ -21,7 +21,6 @@ import ( "fmt" "os" - "github.com/arduino/arduino-cli/internal/cli/configuration" "github.com/arduino/arduino-cli/internal/cli/feedback" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" "github.com/sirupsen/logrus" @@ -29,7 +28,7 @@ import ( "gopkg.in/yaml.v3" ) -func initGetCommand(srv rpc.ArduinoCoreServiceServer, defaultSettings *configuration.Settings) *cobra.Command { +func initGetCommand(srv rpc.ArduinoCoreServiceServer) *cobra.Command { getCommand := &cobra.Command{ Use: "get", Short: tr("Gets a settings key value."), @@ -43,7 +42,8 @@ func initGetCommand(srv rpc.ArduinoCoreServiceServer, defaultSettings *configura runGetCommand(srv, args) }, ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return defaultSettings.AllKeys(), cobra.ShellCompDirectiveDefault + ctx := cmd.Context() + return getAllSettingsKeys(ctx, srv), cobra.ShellCompDirectiveDefault }, } return getCommand @@ -59,8 +59,7 @@ func runGetCommand(srv rpc.ArduinoCoreServiceServer, args []string) { feedback.Fatal(tr("Cannot get the configuration key %[1]s: %[2]v", toGet, err), feedback.ErrGeneric) } var result getResult - err = json.Unmarshal([]byte(resp.GetJsonData()), &result.resp) - if err != nil { + if err := json.Unmarshal([]byte(resp.GetValueJson()), &result.resp); err != nil { // Should never happen... panic(fmt.Sprintf("Cannot parse JSON for key %[1]s: %[2]v", toGet, err)) } diff --git a/internal/cli/config/init.go b/internal/cli/config/init.go index 5bbc753b153..97eb54cbb77 100644 --- a/internal/cli/config/init.go +++ b/internal/cli/config/init.go @@ -16,12 +16,12 @@ package config import ( + "context" "os" - "strings" "github.com/arduino/arduino-cli/internal/cli/arguments" - "github.com/arduino/arduino-cli/internal/cli/configuration" "github.com/arduino/arduino-cli/internal/cli/feedback" + rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" "github.com/arduino/go-paths-helper" "github.com/sirupsen/logrus" "github.com/spf13/cobra" @@ -35,7 +35,7 @@ var ( const defaultFileName = "arduino-cli.yaml" -func initInitCommand(defaultSettings *configuration.Settings) *cobra.Command { +func initInitCommand(srv rpc.ArduinoCoreServiceServer) *cobra.Command { initCommand := &cobra.Command{ Use: "init", Short: tr("Writes current configuration to a configuration file."), @@ -50,7 +50,7 @@ func initInitCommand(defaultSettings *configuration.Settings) *cobra.Command { arguments.CheckFlagsConflicts(cmd, "dest-file", "dest-dir") }, Run: func(cmd *cobra.Command, args []string) { - runInitCommand(cmd, defaultSettings) + runInitCommand(srv) }, } initCommand.Flags().StringVar(&destDir, "dest-dir", "", tr("Sets where to save the configuration file.")) @@ -59,8 +59,9 @@ func initInitCommand(defaultSettings *configuration.Settings) *cobra.Command { return initCommand } -func runInitCommand(cmd *cobra.Command, defaultSettings *configuration.Settings) { +func runInitCommand(srv rpc.ArduinoCoreServiceServer) { logrus.Info("Executing `arduino-cli config init`") + ctx := context.Background() var configFileAbsPath *paths.Path var configFileDir *paths.Path @@ -72,17 +73,18 @@ func runInitCommand(cmd *cobra.Command, defaultSettings *configuration.Settings) if err != nil { feedback.Fatal(tr("Cannot find absolute path: %v", err), feedback.ErrGeneric) } - configFileDir = configFileAbsPath.Parent() - case destDir == "": - destDir = defaultSettings.GetString("directories.Data") - fallthrough - default: + + case destDir != "": configFileDir, err = paths.New(destDir).Abs() if err != nil { feedback.Fatal(tr("Cannot find absolute path: %v", err), feedback.ErrGeneric) } configFileAbsPath = configFileDir.Join(defaultFileName) + + default: + configFileAbsPath = paths.New(ctx.Value("config_file").(string)) + configFileDir = configFileAbsPath.Parent() } if !overwrite && configFileAbsPath.Exist() { @@ -95,19 +97,22 @@ func runInitCommand(cmd *cobra.Command, defaultSettings *configuration.Settings) feedback.Fatal(tr("Cannot create config file directory: %v", err), feedback.ErrGeneric) } - newSettings := configuration.NewSettings() - configuration.BindFlags(cmd, newSettings) + // for _, url := range newSettings.GetStringSlice("board_manager.additional_urls") { + // if strings.Contains(url, ",") { + // feedback.Fatal(tr("Urls cannot contain commas. Separate multiple urls exported as env var with a space:\n%s", url), + // feedback.ErrGeneric) + // } + // } - for _, url := range newSettings.GetStringSlice("board_manager.additional_urls") { - if strings.Contains(url, ",") { - feedback.Fatal(tr("Urls cannot contain commas. Separate multiple urls exported as env var with a space:\n%s", url), - feedback.ErrGeneric) - } + resp, err := srv.ConfigurationSave(ctx, &rpc.ConfigurationSaveRequest{Format: "yaml"}) + if err != nil { + feedback.Fatal(tr("Error creating configuration: %v", err), feedback.ErrGeneric) } - if err := newSettings.WriteConfigAs(configFileAbsPath.String()); err != nil { + if err := configFileAbsPath.WriteFile([]byte(resp.GetEncodedSettings())); err != nil { feedback.Fatal(tr("Cannot create config file: %v", err), feedback.ErrGeneric) } + feedback.PrintResult(initResult{ConfigFileAbsPath: configFileAbsPath}) } diff --git a/internal/cli/config/remove.go b/internal/cli/config/remove.go index efbd416913a..070cce16966 100644 --- a/internal/cli/config/remove.go +++ b/internal/cli/config/remove.go @@ -16,16 +16,18 @@ package config import ( + "context" + "encoding/json" "os" - "reflect" + "slices" - "github.com/arduino/arduino-cli/internal/cli/configuration" "github.com/arduino/arduino-cli/internal/cli/feedback" + rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) -func initRemoveCommand(defaultSettings *configuration.Settings) *cobra.Command { +func initRemoveCommand(srv rpc.ArduinoCoreServiceServer) *cobra.Command { removeCommand := &cobra.Command{ Use: "remove", Short: tr("Removes one or more values from a setting."), @@ -35,39 +37,42 @@ func initRemoveCommand(defaultSettings *configuration.Settings) *cobra.Command { " " + os.Args[0] + " config remove board_manager.additional_urls https://example.com/package_example_index.json https://another-url.com/package_another_index.json\n", Args: cobra.MinimumNArgs(2), Run: func(cmd *cobra.Command, args []string) { - runRemoveCommand(args, defaultSettings) + ctx := cmd.Context() + runRemoveCommand(ctx, srv, args) }, ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return GetSlicesConfigurationKeys(defaultSettings), cobra.ShellCompDirectiveDefault + ctx := cmd.Context() + return getAllArraySettingsKeys(ctx, srv), cobra.ShellCompDirectiveDefault }, } return removeCommand } -func runRemoveCommand(args []string, defaultSettings *configuration.Settings) { +func runRemoveCommand(ctx context.Context, srv rpc.ArduinoCoreServiceServer, args []string) { logrus.Info("Executing `arduino-cli config remove`") key := args[0] - kind := validateKey(key) - if kind != reflect.Slice { + if !slices.Contains(getAllArraySettingsKeys(ctx, srv), key) { msg := tr("The key '%[1]v' is not a list of items, can't remove from it.\nMaybe use '%[2]s'?", key, "config delete") feedback.Fatal(msg, feedback.ErrGeneric) } - mappedValues := map[string]bool{} - for _, v := range defaultSettings.GetStringSlice(key) { - mappedValues[v] = true + var currentValues []string + if resp, err := srv.SettingsGetValue(ctx, &rpc.SettingsGetValueRequest{Key: key}); err != nil { + feedback.Fatal(tr("Cannot get the configuration key %[1]s: %[2]v", key, err), feedback.ErrGeneric) + } else if err := json.Unmarshal([]byte(resp.GetValueJson()), ¤tValues); err != nil { + feedback.Fatal(tr("Cannot get the configuration key %[1]s: %[2]v", key, err), feedback.ErrGeneric) } + for _, arg := range args[1:] { - delete(mappedValues, arg) - } - values := []string{} - for k := range mappedValues { - values = append(values, k) + currentValues = slices.DeleteFunc(currentValues, func(in string) bool { return in == arg }) } - defaultSettings.Set(key, values) - if err := defaultSettings.WriteConfig(); err != nil { - feedback.Fatal(tr("Can't write config file: %v", err), feedback.ErrGeneric) + if newValuesJSON, err := json.Marshal(currentValues); err != nil { + feedback.Fatal(tr("Cannot remove the configuration key %[1]s: %[2]v", key, err), feedback.ErrGeneric) + } else if _, err := srv.SettingsSetValue(ctx, &rpc.SettingsSetValueRequest{Key: key, ValueJson: string(newValuesJSON)}); err != nil { + feedback.Fatal(tr("Cannot remove the configuration key %[1]s: %[2]v", key, err), feedback.ErrGeneric) } + + saveConfiguration(ctx, srv) } diff --git a/internal/cli/config/set.go b/internal/cli/config/set.go index 10fb9e6f239..32115e4affb 100644 --- a/internal/cli/config/set.go +++ b/internal/cli/config/set.go @@ -16,17 +16,17 @@ package config import ( + "context" + "encoding/json" "os" - "reflect" - "strconv" - "github.com/arduino/arduino-cli/internal/cli/configuration" "github.com/arduino/arduino-cli/internal/cli/feedback" + rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) -func initSetCommand(defaultSettings *configuration.Settings) *cobra.Command { +func initSetCommand(srv rpc.ArduinoCoreServiceServer) *cobra.Command { setCommand := &cobra.Command{ Use: "set", Short: tr("Sets a setting value."), @@ -38,41 +38,41 @@ func initSetCommand(defaultSettings *configuration.Settings) *cobra.Command { " " + os.Args[0] + " config set board_manager.additional_urls https://example.com/package_example_index.json https://another-url.com/package_another_index.json", Args: cobra.MinimumNArgs(2), Run: func(cmd *cobra.Command, args []string) { - runSetCommand(defaultSettings, args) + runSetCommand(cmd.Context(), srv, args) }, ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return defaultSettings.AllKeys(), cobra.ShellCompDirectiveDefault + ctx := cmd.Context() + return getAllSettingsKeys(ctx, srv), cobra.ShellCompDirectiveDefault }, } return setCommand } -func runSetCommand(defaultSettings *configuration.Settings, args []string) { +func runSetCommand(ctx context.Context, srv rpc.ArduinoCoreServiceServer, args []string) { logrus.Info("Executing `arduino-cli config set`") - key := args[0] - kind := validateKey(key) - - if kind != reflect.Slice && len(args) > 2 { - feedback.Fatal(tr("Can't set multiple values in key %v", key), feedback.ErrGeneric) - } - var value interface{} - switch kind { - case reflect.Slice: - value = uniquify(args[1:]) - case reflect.String: - value = args[1] - case reflect.Bool: - var err error - value, err = strconv.ParseBool(args[1]) + key := args[0] + value := "" + if len(args) == 2 { + v, err := json.Marshal(args[1]) if err != nil { - feedback.Fatal(tr("error parsing value: %v", err), feedback.ErrGeneric) + feedback.Fatal(tr("Error setting value: %v", err), feedback.ErrGeneric) } + value = string(v) + } else { + v, err := json.Marshal(args[1:]) + if err != nil { + feedback.Fatal(tr("Error setting value: %v", err), feedback.ErrGeneric) + } + value = string(v) } - - defaultSettings.Set(key, value) - - if err := defaultSettings.WriteConfig(); err != nil { - feedback.Fatal(tr("Writing config file: %v", err), feedback.ErrGeneric) + _, err := srv.SettingsSetValue(ctx, &rpc.SettingsSetValueRequest{ + Key: key, + ValueJson: value, + }) + if err != nil { + feedback.Fatal(tr("Error setting value: %v", err), feedback.ErrGeneric) } + + saveConfiguration(ctx, srv) } diff --git a/internal/cli/config/validate.go b/internal/cli/config/validate.go deleted file mode 100644 index f494bfaac0b..00000000000 --- a/internal/cli/config/validate.go +++ /dev/null @@ -1,61 +0,0 @@ -// This file is part of arduino-cli. -// -// Copyright 2020 ARDUINO SA (http://www.arduino.cc/) -// -// This software is released under the GNU General Public License version 3, -// which covers the main part of arduino-cli. -// The terms of this license can be found at: -// https://www.gnu.org/licenses/gpl-3.0.en.html -// -// You can be released from the requirements of the above licenses by purchasing -// a commercial license. Buying such a license is mandatory if you want to -// modify or otherwise use the software for commercial activities involving the -// Arduino software without disclosing the source code of your own applications. -// To purchase a commercial license, send an email to license@arduino.cc. - -package config - -import ( - "fmt" - "reflect" - - "github.com/arduino/arduino-cli/internal/cli/feedback" -) - -var validMap = map[string]reflect.Kind{ - "board_manager.additional_urls": reflect.Slice, - "daemon.port": reflect.String, - "directories.data": reflect.String, - "directories.downloads": reflect.String, - "directories.user": reflect.String, - "directories.builtin.tools": reflect.String, - "directories.builtin.libraries": reflect.String, - "library.enable_unsafe_install": reflect.Bool, - "locale": reflect.String, - "logging.file": reflect.String, - "logging.format": reflect.String, - "logging.level": reflect.String, - "sketch.always_export_binaries": reflect.Bool, - "metrics.addr": reflect.String, - "metrics.enabled": reflect.Bool, - "network.proxy": reflect.String, - "network.user_agent_ext": reflect.String, - "output.no_color": reflect.Bool, - "updater.enable_notification": reflect.Bool, -} - -func typeOf(key string) (reflect.Kind, error) { - t, ok := validMap[key] - if !ok { - return reflect.Invalid, fmt.Errorf(tr("Settings key doesn't exist")) - } - return t, nil -} - -func validateKey(key string) reflect.Kind { - kind, err := typeOf(key) - if err != nil { - feedback.FatalError(err, feedback.ErrGeneric) - } - return kind -} diff --git a/internal/cli/configuration/build_cache.go b/internal/cli/configuration/build_cache.go new file mode 100644 index 00000000000..a4bca322307 --- /dev/null +++ b/internal/cli/configuration/build_cache.go @@ -0,0 +1,34 @@ +// This file is part of arduino-cli. +// +// Copyright 2024 ARDUINO SA (http://www.arduino.cc/) +// +// This software is released under the GNU General Public License version 3, +// which covers the main part of arduino-cli. +// The terms of this license can be found at: +// https://www.gnu.org/licenses/gpl-3.0.en.html +// +// You can be released from the requirements of the above licenses by purchasing +// a commercial license. Buying such a license is mandatory if you want to +// modify or otherwise use the software for commercial activities involving the +// Arduino software without disclosing the source code of your own applications. +// To purchase a commercial license, send an email to license@arduino.cc. + +package configuration + +import "time" + +// GetCompilationsBeforeBuildCachePurge returns the number of compilations before the build cache is purged. +func (s *Settings) GetCompilationsBeforeBuildCachePurge() uint { + if res, ok, _ := s.GetUintOk("build_cache.compilations_before_purge"); ok { + return res + } + return s.Defaults.GetUint("build_cache.compilations_before_purge") +} + +// GetBuildCacheTTL returns the time-to-live of the build cache (i.e. the minimum age to wait before purging the cache). +func (s *Settings) GetBuildCacheTTL() time.Duration { + if res, ok, _ := s.GetDurationOk("build_cache.ttl"); ok { + return res + } + return s.Defaults.GetDuration("build_cache.ttl") +} diff --git a/internal/cli/configuration/configuration.go b/internal/cli/configuration/configuration.go index 996a1b1cbfc..1dc7f8d02e5 100644 --- a/internal/cli/configuration/configuration.go +++ b/internal/cli/configuration/configuration.go @@ -19,72 +19,73 @@ import ( "os" "path/filepath" "runtime" - "strings" "github.com/arduino/arduino-cli/internal/cli/feedback" "github.com/arduino/arduino-cli/internal/i18n" - paths "github.com/arduino/go-paths-helper" "github.com/arduino/go-win32-utils" - "github.com/spf13/cobra" - "github.com/spf13/viper" + "go.bug.st/configmap" ) var tr = i18n.Tr // Settings contains the configuration of the Arduino CLI core service type Settings struct { - *viper.Viper + *configmap.Map + Defaults *configmap.Map } // NewSettings creates a new instance of Settings with the default values set func NewSettings() *Settings { - res := &Settings{viper.New()} + res := &Settings{ + Map: configmap.New(), + Defaults: configmap.New(), + } SetDefaults(res) return res } -// Init initialize defaults and read the configuration file. -// Please note the logging system hasn't been configured yet, -// so logging shouldn't be used here. -func Init(configFile string) *Settings { - // Create a new viper instance with default values for all the settings - settings := NewSettings() - - // Set config name and config path - if configFilePath := paths.New(configFile); configFilePath != nil { - settings.SetConfigName(strings.TrimSuffix(configFilePath.Base(), configFilePath.Ext())) - settings.AddConfigPath(configFilePath.Parent().String()) - } else { - configDir := settings.GetString("directories.Data") - // Get default data path if none was provided - if configDir == "" { - configDir = getDefaultArduinoDataDir() - } - - settings.SetConfigName("arduino-cli") - settings.AddConfigPath(configDir) - } - - // Attempt to read config file - if err := settings.ReadInConfig(); err != nil { - // ConfigFileNotFoundError is acceptable, anything else - // should be reported to the user - if _, ok := err.(viper.ConfigFileNotFoundError); !ok { - feedback.Warning(tr("Error reading config file: %v", err)) - } - } - - return settings -} +// // Init initialize defaults and read the configuration file. +// // Please note the logging system hasn't been configured yet, +// // so logging shouldn't be used here. +// func Init(configFile string) *Settings { +// // Create a new viper instance with default values for all the settings +// settings := NewSettings() + +// // Set config name and config path +// if configFilePath := paths.New(configFile); configFilePath != nil { +// settings.SetConfigName(strings.TrimSuffix(configFilePath.Base(), configFilePath.Ext())) +// settings.AddConfigPath(configFilePath.Parent().String()) +// } else { +// configDir := settings.GetString("directories.Data") +// // Get default data path if none was provided +// if configDir == "" { +// configDir = getDefaultArduinoDataDir() +// } + +// settings.SetConfigName("arduino-cli") +// settings.AddConfigPath(configDir) +// } + +// // Attempt to read config file +// if err := settings.ReadInConfig(); err != nil { +// // ConfigFileNotFoundError is acceptable, anything else +// // should be reported to the user +// if _, ok := err.(viper.ConfigFileNotFoundError); !ok { +// feedback.Warning(tr("Error reading config file: %v", err)) +// } +// } + +// return settings +// } // BindFlags creates all the flags binding between the cobra Command and the instance of viper -func BindFlags(cmd *cobra.Command, settings *Settings) { - settings.BindPFlag("logging.level", cmd.Flag("log-level")) - settings.BindPFlag("logging.file", cmd.Flag("log-file")) - settings.BindPFlag("logging.format", cmd.Flag("log-format")) - settings.BindPFlag("board_manager.additional_urls", cmd.Flag("additional-urls")) - settings.BindPFlag("output.no_color", cmd.Flag("no-color")) -} +// func BindFlags(cmd *cobra.Command, settings *Settings) { +// settings.BindPFlag("logging.level", cmd.Flag("log-level")) +// settings.BindPFlag("logging.file", cmd.Flag("log-file")) +// settings.BindPFlag("logging.format", cmd.Flag("log-format")) +// settings.BindPFlag("board_manager.additional_urls", cmd.Flag("additional-urls")) +// settings.BindPFlag("output.no_color", cmd.Flag("no-color")) +// } // getDefaultArduinoDataDir returns the full path to the default arduino folder func getDefaultArduinoDataDir() string { @@ -136,11 +137,6 @@ func getDefaultUserDir() string { } } -// GetDefaultBuiltinLibrariesDir returns the full path to the default builtin libraries dir -func GetDefaultBuiltinLibrariesDir() string { - return filepath.Join(getDefaultArduinoDataDir(), "libraries") -} - // FindConfigFileInArgsFallbackOnEnv returns the config file path using the // argument '--config-file' (if specified), if empty looks for the ARDUINO_CONFIG_FILE env, // or looking in the current working dir diff --git a/internal/cli/configuration/defaults.go b/internal/cli/configuration/defaults.go index c983310a746..1f83e2b5f2c 100644 --- a/internal/cli/configuration/defaults.go +++ b/internal/cli/configuration/defaults.go @@ -16,55 +16,52 @@ package configuration import ( - "path/filepath" - "strings" + "os" "time" ) // SetDefaults sets the default values for certain keys func SetDefaults(settings *Settings) { // logging - settings.SetDefault("logging.level", "info") - settings.SetDefault("logging.format", "text") + settings.Defaults.SetString("logging.level", "info") + settings.Defaults.SetString("logging.format", "text") // Libraries - settings.SetDefault("library.enable_unsafe_install", false) + settings.Defaults.SetBool("library.enable_unsafe_install", false) // Boards Manager - settings.SetDefault("board_manager.additional_urls", []string{}) + settings.Defaults.Set("board_manager.additional_urls", []string{}) // arduino directories - settings.SetDefault("directories.Data", getDefaultArduinoDataDir()) - settings.SetDefault("directories.Downloads", filepath.Join(getDefaultArduinoDataDir(), "staging")) - settings.SetDefault("directories.User", getDefaultUserDir()) + settings.Defaults.SetString("directories.data", getDefaultArduinoDataDir()) + settings.Defaults.SetString("directories.downloads", "") + settings.Defaults.SetString("directories.user", getDefaultUserDir()) // Sketch compilation - settings.SetDefault("sketch.always_export_binaries", false) - settings.SetDefault("build_cache.ttl", time.Hour*24*30) - settings.SetDefault("build_cache.compilations_before_purge", 10) + settings.Defaults.SetBool("sketch.always_export_binaries", false) + settings.Defaults.SetUint("build_cache.ttl", uint(time.Hour*24*30)) + settings.Defaults.SetUint("build_cache.compilations_before_purge", 10) // daemon settings - settings.SetDefault("daemon.port", "50051") + settings.Defaults.SetString("daemon.port", "50051") // metrics settings - settings.SetDefault("metrics.enabled", true) - settings.SetDefault("metrics.addr", ":9090") + settings.Defaults.SetBool("metrics.enabled", true) + settings.Defaults.SetString("metrics.addr", ":9090") // output settings - settings.SetDefault("output.no_color", false) + settings.Defaults.SetBool("output.no_color", false) // updater settings - settings.SetDefault("updater.enable_notification", true) + settings.Defaults.SetBool("updater.enable_notification", true) // Bind env vars - settings.SetEnvPrefix("ARDUINO") - settings.SetEnvKeyReplacer(strings.NewReplacer(".", "_")) - settings.AutomaticEnv() + settings.Defaults.InjectEnvVars(os.Environ(), "ARDUINO") // Bind env aliases to keep backward compatibility - settings.BindEnv("library.enable_unsafe_install", "ARDUINO_ENABLE_UNSAFE_LIBRARY_INSTALL") - settings.BindEnv("directories.User", "ARDUINO_SKETCHBOOK_DIR") - settings.BindEnv("directories.Downloads", "ARDUINO_DOWNLOADS_DIR") - settings.BindEnv("directories.Data", "ARDUINO_DATA_DIR") - settings.BindEnv("sketch.always_export_binaries", "ARDUINO_SKETCH_ALWAYS_EXPORT_BINARIES") + // settings.defaults.BindEnv("library.enable_unsafe_install", "ARDUINO_ENABLE_UNSAFE_LIBRARY_INSTALL") + // settings.defaults.BindEnv("directories.User", "ARDUINO_SKETCHBOOK_DIR") + // settings.defaults.BindEnv("directories.Downloads", "ARDUINO_DOWNLOADS_DIR") + // settings.defaults.BindEnv("directories.Data", "ARDUINO_DATA_DIR") + // settings.defaults.BindEnv("sketch.always_export_binaries", "ARDUINO_SKETCH_ALWAYS_EXPORT_BINARIES") } diff --git a/internal/cli/configuration/directories.go b/internal/cli/configuration/directories.go index 0fb9a9d19e5..a58aa21f885 100644 --- a/internal/cli/configuration/directories.go +++ b/internal/cli/configuration/directories.go @@ -20,20 +20,15 @@ import ( ) // HardwareDirectories returns all paths that may contains hardware packages. -func HardwareDirectories(settings *Settings) paths.PathList { +func (settings *Settings) HardwareDirectories() paths.PathList { res := paths.PathList{} - if settings.IsSet("directories.Data") { - packagesDir := PackagesDir(settings) - if packagesDir.IsDir() { - res.Add(packagesDir) - } + if packagesDir := settings.PackagesDir(); packagesDir.IsDir() { + res.Add(packagesDir) } - if settings.IsSet("directories.User") { - skDir := paths.New(settings.GetString("directories.User")) - hwDir := skDir.Join("hardware") - if hwDir.IsDir() { + if userDir, ok, _ := settings.GetStringOk("directories.user"); ok { + if hwDir := paths.New(userDir, "hardware"); hwDir.IsDir() { res.Add(hwDir) } } @@ -43,34 +38,51 @@ func HardwareDirectories(settings *Settings) paths.PathList { // IDEBuiltinLibrariesDir returns the IDE-bundled libraries path. Usually // this directory is present in the Arduino IDE. -func IDEBuiltinLibrariesDir(settings *Settings) *paths.Path { - return paths.New(settings.GetString("directories.builtin.Libraries")) +func (settings *Settings) IDEBuiltinLibrariesDir() *paths.Path { + if builtinLibsDir, ok, _ := settings.GetStringOk("directories.builtin.libraries"); ok { + return paths.New(builtinLibsDir) + } + return nil } // LibrariesDir returns the full path to the user directory containing // custom libraries -func LibrariesDir(settings *Settings) *paths.Path { - return paths.New(settings.GetString("directories.User")).Join("libraries") +func (settings *Settings) LibrariesDir() *paths.Path { + return settings.UserDir().Join("libraries") +} + +// UserDir returns the full path to the user directory +func (settings *Settings) UserDir() *paths.Path { + if userDir, ok, _ := settings.GetStringOk("directories.user"); ok { + return paths.New(userDir) + } + return paths.New(settings.Defaults.GetString("directories.user")) } // PackagesDir returns the full path to the packages folder -func PackagesDir(settings *Settings) *paths.Path { - return DataDir(settings).Join("packages") +func (settings *Settings) PackagesDir() *paths.Path { + return settings.DataDir().Join("packages") } // ProfilesCacheDir returns the full path to the profiles cache directory // (it contains all the platforms and libraries used to compile a sketch // using profiles) -func ProfilesCacheDir(settings *Settings) *paths.Path { - return DataDir(settings).Join("internal") +func (settings *Settings) ProfilesCacheDir() *paths.Path { + return settings.DataDir().Join("internal") } // DataDir returns the full path to the data directory -func DataDir(settings *Settings) *paths.Path { - return paths.New(settings.GetString("directories.Data")) +func (settings *Settings) DataDir() *paths.Path { + if dataDir, ok, _ := settings.GetStringOk("directories.data"); ok { + return paths.New(dataDir) + } + return paths.New(settings.Defaults.GetString("directories.data")) } // DownloadsDir returns the full path to the download cache directory -func DownloadsDir(settings *Settings) *paths.Path { - return paths.New(settings.GetString("directories.Downloads")) +func (settings *Settings) DownloadsDir() *paths.Path { + if downloadDir, ok, _ := settings.GetStringOk("directories.downloads"); ok { + return paths.New(downloadDir) + } + return settings.DataDir().Join("staging") } diff --git a/internal/cli/configuration/network.go b/internal/cli/configuration/network.go index c88b974c10d..086c9d2091e 100644 --- a/internal/cli/configuration/network.go +++ b/internal/cli/configuration/network.go @@ -52,14 +52,8 @@ func UserAgent(settings *Settings) string { } // NetworkProxy returns the proxy configuration (mainly used by HTTP clients) -func NetworkProxy(settings *Settings) (*url.URL, error) { - if settings == nil || !settings.IsSet("network.proxy") { - return nil, nil - } - if proxyConfig := settings.GetString("network.proxy"); proxyConfig == "" { - // empty configuration - // this workaround must be here until viper can UnSet properties: - // https://github.com/spf13/viper/pull/519 +func (settings *Settings) NetworkProxy() (*url.URL, error) { + if proxyConfig, ok, _ := settings.GetStringOk("network.proxy"); !ok { return nil, nil } else if proxy, err := url.Parse(proxyConfig); err != nil { return nil, fmt.Errorf(tr("Invalid network.proxy '%[1]s': %[2]s"), proxyConfig, err) @@ -70,7 +64,7 @@ func NetworkProxy(settings *Settings) (*url.URL, error) { // NewHttpClient returns a new http client for use in the arduino-cli func (settings *Settings) NewHttpClient() (*http.Client, error) { - proxy, err := NetworkProxy(settings) + proxy, err := settings.NetworkProxy() if err != nil { return nil, err } diff --git a/internal/cli/configuration/sketch.go b/internal/cli/configuration/sketch.go new file mode 100644 index 00000000000..27638b67df5 --- /dev/null +++ b/internal/cli/configuration/sketch.go @@ -0,0 +1,25 @@ +// This file is part of arduino-cli. +// +// Copyright 2024 ARDUINO SA (http://www.arduino.cc/) +// +// This software is released under the GNU General Public License version 3, +// which covers the main part of arduino-cli. +// The terms of this license can be found at: +// https://www.gnu.org/licenses/gpl-3.0.en.html +// +// You can be released from the requirements of the above licenses by purchasing +// a commercial license. Buying such a license is mandatory if you want to +// modify or otherwise use the software for commercial activities involving the +// Arduino software without disclosing the source code of your own applications. +// To purchase a commercial license, send an email to license@arduino.cc. + +package configuration + +// SketchAlwaysExportBinaries returns true if the compile command should +// export binaries by default. +func (settings *Settings) SketchAlwaysExportBinaries() bool { + if res, ok, _ := settings.GetBoolOk("sketch.always_export_binaries"); ok { + return res + } + return settings.Defaults.GetBool("sketch.always_export_binaries") +} diff --git a/internal/cli/daemon/daemon.go b/internal/cli/daemon/daemon.go index 8e719400eaf..1152722cb73 100644 --- a/internal/cli/daemon/daemon.go +++ b/internal/cli/daemon/daemon.go @@ -16,15 +16,16 @@ package daemon import ( + "context" "encoding/json" "errors" "fmt" "net" "os" + "path/filepath" "strings" "syscall" - "github.com/arduino/arduino-cli/internal/cli/configuration" "github.com/arduino/arduino-cli/internal/cli/feedback" "github.com/arduino/arduino-cli/internal/i18n" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" @@ -43,7 +44,7 @@ var ( ) // NewCommand created a new `daemon` command -func NewCommand(srv rpc.ArduinoCoreServiceServer, defaultSettings *configuration.Settings) *cobra.Command { +func NewCommand(srv rpc.ArduinoCoreServiceServer, settings *rpc.Configuration) *cobra.Command { var daemonPort string daemonCommand := &cobra.Command{ Use: "daemon", @@ -52,19 +53,34 @@ func NewCommand(srv rpc.ArduinoCoreServiceServer, defaultSettings *configuration Args: cobra.NoArgs, PreRun: func(cmd *cobra.Command, args []string) { // Bundled libraries support is enabled by default when running as a daemon - defaultSettings.SetDefault( - "directories.builtin.Libraries", - configuration.GetDefaultBuiltinLibrariesDir()) + if settings.GetDirectories().GetBuiltin().GetLibraries() == "" { + defaultBuiltinLibDir := filepath.Join(settings.GetDirectories().GetData(), "libraries") + settings.Directories.Builtin.Libraries = &defaultBuiltinLibDir + } + settings.Daemon.Port = &daemonPort + _, _ = srv.SettingsSet(context.Background(), &rpc.SettingsSetRequest{Settings: settings}) }, Run: func(cmd *cobra.Command, args []string) { runDaemonCommand(srv, daemonPort) }, } - daemonCommand.Flags().StringVar(&daemonPort, "port", defaultSettings.GetString("daemon.port"), tr("The TCP port the daemon will listen to")) - daemonCommand.Flags().BoolVar(&daemonize, "daemonize", false, tr("Do not terminate daemon process if the parent process dies")) - daemonCommand.Flags().BoolVar(&debug, "debug", false, tr("Enable debug logging of gRPC calls")) - daemonCommand.Flags().StringVar(&debugFile, "debug-file", "", tr("Append debug logging to the specified file")) - daemonCommand.Flags().StringSliceVar(&debugFilters, "debug-filter", []string{}, tr("Display only the provided gRPC calls")) + defaultDaemonPort := settings.GetDaemon().GetPort() + + daemonCommand.Flags().StringVar(&daemonPort, + "port", defaultDaemonPort, + tr("The TCP port the daemon will listen to")) + daemonCommand.Flags().BoolVar(&daemonize, + "daemonize", false, + tr("Do not terminate daemon process if the parent process dies")) + daemonCommand.Flags().BoolVar(&debug, + "debug", false, + tr("Enable debug logging of gRPC calls")) + daemonCommand.Flags().StringVar(&debugFile, + "debug-file", "", + tr("Append debug logging to the specified file")) + daemonCommand.Flags().StringSliceVar(&debugFilters, + "debug-filter", []string{}, + tr("Display only the provided gRPC calls")) return daemonCommand } diff --git a/internal/cli/lib/install.go b/internal/cli/lib/install.go index d8aafc8bd1a..7465b4f4fbd 100644 --- a/internal/cli/lib/install.go +++ b/internal/cli/lib/install.go @@ -23,7 +23,6 @@ import ( "github.com/arduino/arduino-cli/commands" "github.com/arduino/arduino-cli/internal/cli/arguments" - "github.com/arduino/arduino-cli/internal/cli/configuration" "github.com/arduino/arduino-cli/internal/cli/feedback" "github.com/arduino/arduino-cli/internal/cli/instance" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" @@ -34,13 +33,13 @@ import ( semver "go.bug.st/relaxed-semver" ) -func initInstallCommand(srv rpc.ArduinoCoreServiceServer, defaultSettings *configuration.Settings) *cobra.Command { +func initInstallCommand(srv rpc.ArduinoCoreServiceServer, settings *rpc.Configuration) *cobra.Command { var noDeps bool var noOverwrite bool var gitURL bool var zipPath bool var useBuiltinLibrariesDir bool - enableUnsafeInstall := defaultSettings.GetBool("library.enable_unsafe_install") + enableUnsafeInstall := settings.GetLibrary().GetEnableUnsafeInstall() installCommand := &cobra.Command{ Use: fmt.Sprintf("install %s[@%s]...", tr("LIBRARY"), tr("VERSION_NUMBER")), Short: tr("Installs one or more specified libraries into the system."), diff --git a/internal/cli/lib/lib.go b/internal/cli/lib/lib.go index d26c8678f08..5aa89cee8dd 100644 --- a/internal/cli/lib/lib.go +++ b/internal/cli/lib/lib.go @@ -18,7 +18,6 @@ package lib import ( "os" - "github.com/arduino/arduino-cli/internal/cli/configuration" "github.com/arduino/arduino-cli/internal/i18n" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" "github.com/spf13/cobra" @@ -27,7 +26,7 @@ import ( var tr = i18n.Tr // NewCommand created a new `lib` command -func NewCommand(srv rpc.ArduinoCoreServiceServer, defaultSettings *configuration.Settings) *cobra.Command { +func NewCommand(srv rpc.ArduinoCoreServiceServer, defaultSettings *rpc.Configuration) *cobra.Command { libCommand := &cobra.Command{ Use: "lib", Short: tr("Arduino commands about libraries."), diff --git a/internal/cli/lib/search.go b/internal/cli/lib/search.go index aa1d0f1b314..4bfa3c06a7c 100644 --- a/internal/cli/lib/search.go +++ b/internal/cli/lib/search.go @@ -116,6 +116,7 @@ func runSearchCommand(srv rpc.ArduinoCoreServiceServer, args []string, namesOnly instance.Init(ctx, srv, inst) } + // Perform library search searchResp, err := srv.LibrarySearch(ctx, &rpc.LibrarySearchRequest{ Instance: inst, SearchArgs: strings.Join(args, " "), diff --git a/internal/docsgen/main.go b/internal/docsgen/main.go index 69ac4983de9..1193ddb4287 100644 --- a/internal/docsgen/main.go +++ b/internal/docsgen/main.go @@ -16,10 +16,13 @@ package main import ( + "context" + "log" "os" + "github.com/arduino/arduino-cli/commands" "github.com/arduino/arduino-cli/internal/cli" - "github.com/arduino/arduino-cli/internal/cli/configuration" + rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" "github.com/spf13/cobra/doc" ) @@ -31,11 +34,14 @@ func main() { os.MkdirAll(os.Args[1], 0755) // Create the output folder if it doesn't already exist - settings := configuration.Init(configuration.FindConfigFileInArgsFallbackOnEnv(os.Args)) - cli := cli.NewCommand(nil, settings) - cli.DisableAutoGenTag = true // Disable addition of auto-generated date stamp - err := doc.GenMarkdownTree(cli, os.Args[1]) + srv := commands.NewArduinoCoreServer() + resp, err := srv.SettingsGet(context.Background(), &rpc.SettingsGetRequest{}) if err != nil { + log.Fatalln(err) + } + cli := cli.NewCommand(srv, resp.GetSettings()) + cli.DisableAutoGenTag = true // Disable addition of auto-generated date stamp + if err := doc.GenMarkdownTree(cli, os.Args[1]); err != nil { panic(err) } } diff --git a/main.go b/main.go index 2255ae626b4..ee4f0c65146 100644 --- a/main.go +++ b/main.go @@ -16,6 +16,8 @@ package main import ( + "context" + "fmt" "os" "github.com/arduino/arduino-cli/commands" @@ -23,17 +25,45 @@ import ( "github.com/arduino/arduino-cli/internal/cli/configuration" "github.com/arduino/arduino-cli/internal/cli/feedback" "github.com/arduino/arduino-cli/internal/i18n" - "github.com/arduino/arduino-cli/version" + rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" + "github.com/arduino/go-paths-helper" ) func main() { - defaultSettings := configuration.Init(configuration.FindConfigFileInArgsFallbackOnEnv(os.Args)) - i18n.Init(defaultSettings.GetString("locale")) + // Create a new ArduinoCoreServer + srv := commands.NewArduinoCoreServer() - srv := commands.NewArduinoCoreServer(version.VersionInfo.VersionString, defaultSettings) + // Search for the configuration file in the command line arguments and in the environment + configFile := configuration.FindConfigFileInArgsFallbackOnEnv(os.Args) + ctx := context.Background() + ctx = context.WithValue(ctx, "config_file", configFile) - arduinoCmd := cli.NewCommand(srv, defaultSettings) - if err := arduinoCmd.Execute(); err != nil { + // Read the settings from the configuration file + if configData, err := paths.New(configFile).ReadFile(); err == nil { + _, err := srv.ConfigurationOpen(ctx, &rpc.ConfigurationOpenRequest{Format: "yaml", EncodedSettings: string(configData)}) + if err != nil { + feedback.FatalError(fmt.Errorf("Couldn't load configuration: %w", err), feedback.ErrGeneric) + } + } else if !os.IsNotExist(err) { + feedback.FatalError(fmt.Errorf("Couldn't read configuration file: %w", err), feedback.ErrGeneric) + // TODO: read from default location + } + + // Get the current settings from the server + resp, err := srv.ConfigurationGet(ctx, &rpc.ConfigurationGetRequest{}) + if err != nil { + feedback.FatalError(err, feedback.ErrGeneric) + } + config := resp.GetConfiguration() + + // Setup i18n + i18n.Init(config.GetLocale()) + + // Setup command line parser with the server and settings + arduinoCmd := cli.NewCommand(srv, config) + + // Execute the command line + if err := arduinoCmd.ExecuteContext(ctx); err != nil { feedback.FatalError(err, feedback.ErrGeneric) } } diff --git a/rpc/cc/arduino/cli/commands/v1/commands.pb.go b/rpc/cc/arduino/cli/commands/v1/commands.pb.go index ca33b869446..859a2bf0900 100644 --- a/rpc/cc/arduino/cli/commands/v1/commands.pb.go +++ b/rpc/cc/arduino/cli/commands/v1/commands.pb.go @@ -2076,7 +2076,7 @@ var file_cc_arduino_cli_commands_v1_commands_proto_rawDesc = []byte{ 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x03, 0x12, 0x34, 0x0a, 0x30, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x5f, 0x49, 0x4e, 0x53, 0x54, 0x41, 0x4e, 0x43, 0x45, 0x5f, 0x49, 0x4e, 0x49, 0x54, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x49, 0x4e, 0x44, 0x45, 0x58, 0x5f, 0x44, 0x4f, 0x57, - 0x4e, 0x4c, 0x4f, 0x41, 0x44, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x04, 0x32, 0xd1, 0x2f, + 0x4e, 0x4c, 0x4f, 0x41, 0x44, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x04, 0x32, 0xfb, 0x2f, 0x0a, 0x12, 0x41, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x43, 0x6f, 0x72, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x61, 0x0a, 0x06, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0x29, 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, @@ -2412,58 +2412,60 @@ var file_cc_arduino_cli_commands_v1_commands_proto_rawDesc = []byte{ 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6c, 0x65, 0x61, 0x6e, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x43, 0x61, 0x63, 0x68, 0x65, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x77, 0x0a, 0x0e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, - 0x73, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x12, 0x31, 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, - 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, - 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x47, 0x65, 0x74, - 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, 0x2e, 0x63, 0x63, 0x2e, - 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, - 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, - 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x74, - 0x0a, 0x0d, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x4d, 0x65, 0x72, 0x67, 0x65, 0x12, - 0x30, 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, - 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, - 0x74, 0x69, 0x6e, 0x67, 0x73, 0x4d, 0x65, 0x72, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x31, 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x80, 0x01, 0x0a, 0x11, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x61, 0x76, 0x65, 0x12, 0x34, 0x2e, 0x63, 0x63, + 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, 0x6f, 0x6d, + 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, + 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x61, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x35, 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, + 0x6c, 0x69, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x61, 0x76, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x80, 0x01, 0x0a, 0x11, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x65, 0x6e, 0x12, 0x34, + 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, + 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x65, 0x6e, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, + 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, + 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4f, + 0x70, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7d, 0x0a, 0x10, 0x43, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x47, 0x65, 0x74, 0x12, + 0x33, 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, + 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, + 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, + 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x47, + 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x80, 0x01, 0x0a, 0x11, 0x53, + 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x45, 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x61, 0x74, 0x65, + 0x12, 0x34, 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, + 0x69, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, + 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x45, 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, + 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, + 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x45, 0x6e, 0x75, 0x6d, + 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7d, 0x0a, + 0x10, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x47, 0x65, 0x74, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x12, 0x33, 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, - 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x4d, 0x65, 0x72, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7d, 0x0a, 0x10, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, - 0x47, 0x65, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x33, 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, - 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, - 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x47, 0x65, - 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, - 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, - 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x74, 0x69, - 0x6e, 0x67, 0x73, 0x47, 0x65, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x7d, 0x0a, 0x10, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x53, - 0x65, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x33, 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, - 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, - 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x53, 0x65, 0x74, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, 0x63, - 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, 0x6f, - 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, - 0x67, 0x73, 0x53, 0x65, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x74, 0x0a, 0x0d, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x57, 0x72, - 0x69, 0x74, 0x65, 0x12, 0x30, 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, - 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, - 0x2e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x57, 0x72, 0x69, 0x74, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, + 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x47, 0x65, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, + 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, + 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x47, 0x65, 0x74, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7d, 0x0a, 0x10, + 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x53, 0x65, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x12, 0x33, 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, + 0x69, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, + 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x53, 0x65, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2e, - 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x57, 0x72, 0x69, 0x74, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x77, 0x0a, 0x0e, 0x53, 0x65, 0x74, 0x74, - 0x69, 0x6e, 0x67, 0x73, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x31, 0x2e, 0x63, 0x63, 0x2e, - 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, - 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, - 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, 0x2e, - 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, - 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x74, 0x69, - 0x6e, 0x67, 0x73, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x42, 0x48, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2d, - 0x63, 0x6c, 0x69, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x63, 0x63, 0x2f, 0x61, 0x72, 0x64, 0x75, 0x69, - 0x6e, 0x6f, 0x2f, 0x63, 0x6c, 0x69, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2f, - 0x76, 0x31, 0x3b, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x53, 0x65, 0x74, 0x56, 0x61, + 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x48, 0x5a, 0x46, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, + 0x6f, 0x2f, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2d, 0x63, 0x6c, 0x69, 0x2f, 0x72, 0x70, + 0x63, 0x2f, 0x63, 0x63, 0x2f, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2f, 0x63, 0x6c, 0x69, + 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2f, 0x76, 0x31, 0x3b, 0x63, 0x6f, 0x6d, + 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2549,12 +2551,12 @@ var file_cc_arduino_cli_commands_v1_commands_proto_goTypes = []interface{}{ (*DebugRequest)(nil), // 65: cc.arduino.cli.commands.v1.DebugRequest (*IsDebugSupportedRequest)(nil), // 66: cc.arduino.cli.commands.v1.IsDebugSupportedRequest (*GetDebugConfigRequest)(nil), // 67: cc.arduino.cli.commands.v1.GetDebugConfigRequest - (*SettingsGetAllRequest)(nil), // 68: cc.arduino.cli.commands.v1.SettingsGetAllRequest - (*SettingsMergeRequest)(nil), // 69: cc.arduino.cli.commands.v1.SettingsMergeRequest - (*SettingsGetValueRequest)(nil), // 70: cc.arduino.cli.commands.v1.SettingsGetValueRequest - (*SettingsSetValueRequest)(nil), // 71: cc.arduino.cli.commands.v1.SettingsSetValueRequest - (*SettingsWriteRequest)(nil), // 72: cc.arduino.cli.commands.v1.SettingsWriteRequest - (*SettingsDeleteRequest)(nil), // 73: cc.arduino.cli.commands.v1.SettingsDeleteRequest + (*ConfigurationSaveRequest)(nil), // 68: cc.arduino.cli.commands.v1.ConfigurationSaveRequest + (*ConfigurationOpenRequest)(nil), // 69: cc.arduino.cli.commands.v1.ConfigurationOpenRequest + (*ConfigurationGetRequest)(nil), // 70: cc.arduino.cli.commands.v1.ConfigurationGetRequest + (*SettingsEnumerateRequest)(nil), // 71: cc.arduino.cli.commands.v1.SettingsEnumerateRequest + (*SettingsGetValueRequest)(nil), // 72: cc.arduino.cli.commands.v1.SettingsGetValueRequest + (*SettingsSetValueRequest)(nil), // 73: cc.arduino.cli.commands.v1.SettingsSetValueRequest (*BoardDetailsResponse)(nil), // 74: cc.arduino.cli.commands.v1.BoardDetailsResponse (*BoardListResponse)(nil), // 75: cc.arduino.cli.commands.v1.BoardListResponse (*BoardListAllResponse)(nil), // 76: cc.arduino.cli.commands.v1.BoardListAllResponse @@ -2586,12 +2588,12 @@ var file_cc_arduino_cli_commands_v1_commands_proto_goTypes = []interface{}{ (*DebugResponse)(nil), // 102: cc.arduino.cli.commands.v1.DebugResponse (*IsDebugSupportedResponse)(nil), // 103: cc.arduino.cli.commands.v1.IsDebugSupportedResponse (*GetDebugConfigResponse)(nil), // 104: cc.arduino.cli.commands.v1.GetDebugConfigResponse - (*SettingsGetAllResponse)(nil), // 105: cc.arduino.cli.commands.v1.SettingsGetAllResponse - (*SettingsMergeResponse)(nil), // 106: cc.arduino.cli.commands.v1.SettingsMergeResponse - (*SettingsGetValueResponse)(nil), // 107: cc.arduino.cli.commands.v1.SettingsGetValueResponse - (*SettingsSetValueResponse)(nil), // 108: cc.arduino.cli.commands.v1.SettingsSetValueResponse - (*SettingsWriteResponse)(nil), // 109: cc.arduino.cli.commands.v1.SettingsWriteResponse - (*SettingsDeleteResponse)(nil), // 110: cc.arduino.cli.commands.v1.SettingsDeleteResponse + (*ConfigurationSaveResponse)(nil), // 105: cc.arduino.cli.commands.v1.ConfigurationSaveResponse + (*ConfigurationOpenResponse)(nil), // 106: cc.arduino.cli.commands.v1.ConfigurationOpenResponse + (*ConfigurationGetResponse)(nil), // 107: cc.arduino.cli.commands.v1.ConfigurationGetResponse + (*SettingsEnumerateResponse)(nil), // 108: cc.arduino.cli.commands.v1.SettingsEnumerateResponse + (*SettingsGetValueResponse)(nil), // 109: cc.arduino.cli.commands.v1.SettingsGetValueResponse + (*SettingsSetValueResponse)(nil), // 110: cc.arduino.cli.commands.v1.SettingsSetValueResponse } var file_cc_arduino_cli_commands_v1_commands_proto_depIdxs = []int32{ 31, // 0: cc.arduino.cli.commands.v1.CreateResponse.instance:type_name -> cc.arduino.cli.commands.v1.Instance @@ -2657,12 +2659,12 @@ var file_cc_arduino_cli_commands_v1_commands_proto_depIdxs = []int32{ 67, // 60: cc.arduino.cli.commands.v1.ArduinoCoreService.GetDebugConfig:input_type -> cc.arduino.cli.commands.v1.GetDebugConfigRequest 24, // 61: cc.arduino.cli.commands.v1.ArduinoCoreService.CheckForArduinoCLIUpdates:input_type -> cc.arduino.cli.commands.v1.CheckForArduinoCLIUpdatesRequest 26, // 62: cc.arduino.cli.commands.v1.ArduinoCoreService.CleanDownloadCacheDirectory:input_type -> cc.arduino.cli.commands.v1.CleanDownloadCacheDirectoryRequest - 68, // 63: cc.arduino.cli.commands.v1.ArduinoCoreService.SettingsGetAll:input_type -> cc.arduino.cli.commands.v1.SettingsGetAllRequest - 69, // 64: cc.arduino.cli.commands.v1.ArduinoCoreService.SettingsMerge:input_type -> cc.arduino.cli.commands.v1.SettingsMergeRequest - 70, // 65: cc.arduino.cli.commands.v1.ArduinoCoreService.SettingsGetValue:input_type -> cc.arduino.cli.commands.v1.SettingsGetValueRequest - 71, // 66: cc.arduino.cli.commands.v1.ArduinoCoreService.SettingsSetValue:input_type -> cc.arduino.cli.commands.v1.SettingsSetValueRequest - 72, // 67: cc.arduino.cli.commands.v1.ArduinoCoreService.SettingsWrite:input_type -> cc.arduino.cli.commands.v1.SettingsWriteRequest - 73, // 68: cc.arduino.cli.commands.v1.ArduinoCoreService.SettingsDelete:input_type -> cc.arduino.cli.commands.v1.SettingsDeleteRequest + 68, // 63: cc.arduino.cli.commands.v1.ArduinoCoreService.ConfigurationSave:input_type -> cc.arduino.cli.commands.v1.ConfigurationSaveRequest + 69, // 64: cc.arduino.cli.commands.v1.ArduinoCoreService.ConfigurationOpen:input_type -> cc.arduino.cli.commands.v1.ConfigurationOpenRequest + 70, // 65: cc.arduino.cli.commands.v1.ArduinoCoreService.ConfigurationGet:input_type -> cc.arduino.cli.commands.v1.ConfigurationGetRequest + 71, // 66: cc.arduino.cli.commands.v1.ArduinoCoreService.SettingsEnumerate:input_type -> cc.arduino.cli.commands.v1.SettingsEnumerateRequest + 72, // 67: cc.arduino.cli.commands.v1.ArduinoCoreService.SettingsGetValue:input_type -> cc.arduino.cli.commands.v1.SettingsGetValueRequest + 73, // 68: cc.arduino.cli.commands.v1.ArduinoCoreService.SettingsSetValue:input_type -> cc.arduino.cli.commands.v1.SettingsSetValueRequest 3, // 69: cc.arduino.cli.commands.v1.ArduinoCoreService.Create:output_type -> cc.arduino.cli.commands.v1.CreateResponse 5, // 70: cc.arduino.cli.commands.v1.ArduinoCoreService.Init:output_type -> cc.arduino.cli.commands.v1.InitResponse 8, // 71: cc.arduino.cli.commands.v1.ArduinoCoreService.Destroy:output_type -> cc.arduino.cli.commands.v1.DestroyResponse @@ -2706,12 +2708,12 @@ var file_cc_arduino_cli_commands_v1_commands_proto_depIdxs = []int32{ 104, // 109: cc.arduino.cli.commands.v1.ArduinoCoreService.GetDebugConfig:output_type -> cc.arduino.cli.commands.v1.GetDebugConfigResponse 25, // 110: cc.arduino.cli.commands.v1.ArduinoCoreService.CheckForArduinoCLIUpdates:output_type -> cc.arduino.cli.commands.v1.CheckForArduinoCLIUpdatesResponse 27, // 111: cc.arduino.cli.commands.v1.ArduinoCoreService.CleanDownloadCacheDirectory:output_type -> cc.arduino.cli.commands.v1.CleanDownloadCacheDirectoryResponse - 105, // 112: cc.arduino.cli.commands.v1.ArduinoCoreService.SettingsGetAll:output_type -> cc.arduino.cli.commands.v1.SettingsGetAllResponse - 106, // 113: cc.arduino.cli.commands.v1.ArduinoCoreService.SettingsMerge:output_type -> cc.arduino.cli.commands.v1.SettingsMergeResponse - 107, // 114: cc.arduino.cli.commands.v1.ArduinoCoreService.SettingsGetValue:output_type -> cc.arduino.cli.commands.v1.SettingsGetValueResponse - 108, // 115: cc.arduino.cli.commands.v1.ArduinoCoreService.SettingsSetValue:output_type -> cc.arduino.cli.commands.v1.SettingsSetValueResponse - 109, // 116: cc.arduino.cli.commands.v1.ArduinoCoreService.SettingsWrite:output_type -> cc.arduino.cli.commands.v1.SettingsWriteResponse - 110, // 117: cc.arduino.cli.commands.v1.ArduinoCoreService.SettingsDelete:output_type -> cc.arduino.cli.commands.v1.SettingsDeleteResponse + 105, // 112: cc.arduino.cli.commands.v1.ArduinoCoreService.ConfigurationSave:output_type -> cc.arduino.cli.commands.v1.ConfigurationSaveResponse + 106, // 113: cc.arduino.cli.commands.v1.ArduinoCoreService.ConfigurationOpen:output_type -> cc.arduino.cli.commands.v1.ConfigurationOpenResponse + 107, // 114: cc.arduino.cli.commands.v1.ArduinoCoreService.ConfigurationGet:output_type -> cc.arduino.cli.commands.v1.ConfigurationGetResponse + 108, // 115: cc.arduino.cli.commands.v1.ArduinoCoreService.SettingsEnumerate:output_type -> cc.arduino.cli.commands.v1.SettingsEnumerateResponse + 109, // 116: cc.arduino.cli.commands.v1.ArduinoCoreService.SettingsGetValue:output_type -> cc.arduino.cli.commands.v1.SettingsGetValueResponse + 110, // 117: cc.arduino.cli.commands.v1.ArduinoCoreService.SettingsSetValue:output_type -> cc.arduino.cli.commands.v1.SettingsSetValueResponse 69, // [69:118] is the sub-list for method output_type 20, // [20:69] is the sub-list for method input_type 20, // [20:20] is the sub-list for extension type_name diff --git a/rpc/cc/arduino/cli/commands/v1/commands.proto b/rpc/cc/arduino/cli/commands/v1/commands.proto index 78660e28d5c..ce5aba9ed91 100644 --- a/rpc/cc/arduino/cli/commands/v1/commands.proto +++ b/rpc/cc/arduino/cli/commands/v1/commands.proto @@ -197,25 +197,28 @@ service ArduinoCoreService { rpc CleanDownloadCacheDirectory(CleanDownloadCacheDirectoryRequest) returns (CleanDownloadCacheDirectoryResponse); - // List all the settings. - rpc SettingsGetAll(SettingsGetAllRequest) returns (SettingsGetAllResponse); + // Writes the settings currently stored in memory in a YAML file + rpc ConfigurationSave(ConfigurationSaveRequest) + returns (ConfigurationSaveResponse); - // Set multiple settings values at once. - rpc SettingsMerge(SettingsMergeRequest) returns (SettingsMergeResponse); + // Read the settings from a YAML file + rpc ConfigurationOpen(ConfigurationOpenRequest) + returns (ConfigurationOpenResponse); - // Get the value of a specific setting. + rpc ConfigurationGet(ConfigurationGetRequest) + returns (ConfigurationGetResponse); + + // Enumerate all the keys/values pairs available in the configuration + rpc SettingsEnumerate(SettingsEnumerateRequest) + returns (SettingsEnumerateResponse); + + // Get a single configuration value rpc SettingsGetValue(SettingsGetValueRequest) returns (SettingsGetValueResponse); - // Set the value of a specific setting. + // Set a single configuration value rpc SettingsSetValue(SettingsSetValueRequest) returns (SettingsSetValueResponse); - - // Writes to file settings currently stored in memory - rpc SettingsWrite(SettingsWriteRequest) returns (SettingsWriteResponse); - - // Deletes an entry and rewrites the file settings - rpc SettingsDelete(SettingsDeleteRequest) returns (SettingsDeleteResponse); } message CreateRequest {} diff --git a/rpc/cc/arduino/cli/commands/v1/commands_grpc.pb.go b/rpc/cc/arduino/cli/commands/v1/commands_grpc.pb.go index 5021e89d488..4ebd93a59f0 100644 --- a/rpc/cc/arduino/cli/commands/v1/commands_grpc.pb.go +++ b/rpc/cc/arduino/cli/commands/v1/commands_grpc.pb.go @@ -77,12 +77,12 @@ const ( ArduinoCoreService_GetDebugConfig_FullMethodName = "/cc.arduino.cli.commands.v1.ArduinoCoreService/GetDebugConfig" ArduinoCoreService_CheckForArduinoCLIUpdates_FullMethodName = "/cc.arduino.cli.commands.v1.ArduinoCoreService/CheckForArduinoCLIUpdates" ArduinoCoreService_CleanDownloadCacheDirectory_FullMethodName = "/cc.arduino.cli.commands.v1.ArduinoCoreService/CleanDownloadCacheDirectory" - ArduinoCoreService_SettingsGetAll_FullMethodName = "/cc.arduino.cli.commands.v1.ArduinoCoreService/SettingsGetAll" - ArduinoCoreService_SettingsMerge_FullMethodName = "/cc.arduino.cli.commands.v1.ArduinoCoreService/SettingsMerge" + ArduinoCoreService_ConfigurationSave_FullMethodName = "/cc.arduino.cli.commands.v1.ArduinoCoreService/ConfigurationSave" + ArduinoCoreService_ConfigurationOpen_FullMethodName = "/cc.arduino.cli.commands.v1.ArduinoCoreService/ConfigurationOpen" + ArduinoCoreService_ConfigurationGet_FullMethodName = "/cc.arduino.cli.commands.v1.ArduinoCoreService/ConfigurationGet" + ArduinoCoreService_SettingsEnumerate_FullMethodName = "/cc.arduino.cli.commands.v1.ArduinoCoreService/SettingsEnumerate" ArduinoCoreService_SettingsGetValue_FullMethodName = "/cc.arduino.cli.commands.v1.ArduinoCoreService/SettingsGetValue" ArduinoCoreService_SettingsSetValue_FullMethodName = "/cc.arduino.cli.commands.v1.ArduinoCoreService/SettingsSetValue" - ArduinoCoreService_SettingsWrite_FullMethodName = "/cc.arduino.cli.commands.v1.ArduinoCoreService/SettingsWrite" - ArduinoCoreService_SettingsDelete_FullMethodName = "/cc.arduino.cli.commands.v1.ArduinoCoreService/SettingsDelete" ) // ArduinoCoreServiceClient is the client API for ArduinoCoreService service. @@ -183,18 +183,17 @@ type ArduinoCoreServiceClient interface { CheckForArduinoCLIUpdates(ctx context.Context, in *CheckForArduinoCLIUpdatesRequest, opts ...grpc.CallOption) (*CheckForArduinoCLIUpdatesResponse, error) // Clean the download cache directory (where archives are downloaded). CleanDownloadCacheDirectory(ctx context.Context, in *CleanDownloadCacheDirectoryRequest, opts ...grpc.CallOption) (*CleanDownloadCacheDirectoryResponse, error) - // List all the settings. - SettingsGetAll(ctx context.Context, in *SettingsGetAllRequest, opts ...grpc.CallOption) (*SettingsGetAllResponse, error) - // Set multiple settings values at once. - SettingsMerge(ctx context.Context, in *SettingsMergeRequest, opts ...grpc.CallOption) (*SettingsMergeResponse, error) - // Get the value of a specific setting. + // Writes the settings currently stored in memory in a YAML file + ConfigurationSave(ctx context.Context, in *ConfigurationSaveRequest, opts ...grpc.CallOption) (*ConfigurationSaveResponse, error) + // Read the settings from a YAML file + ConfigurationOpen(ctx context.Context, in *ConfigurationOpenRequest, opts ...grpc.CallOption) (*ConfigurationOpenResponse, error) + ConfigurationGet(ctx context.Context, in *ConfigurationGetRequest, opts ...grpc.CallOption) (*ConfigurationGetResponse, error) + // Enumerate all the keys/values pairs available in the configuration + SettingsEnumerate(ctx context.Context, in *SettingsEnumerateRequest, opts ...grpc.CallOption) (*SettingsEnumerateResponse, error) + // Get a single configuration value SettingsGetValue(ctx context.Context, in *SettingsGetValueRequest, opts ...grpc.CallOption) (*SettingsGetValueResponse, error) - // Set the value of a specific setting. + // Set a single configuration value SettingsSetValue(ctx context.Context, in *SettingsSetValueRequest, opts ...grpc.CallOption) (*SettingsSetValueResponse, error) - // Writes to file settings currently stored in memory - SettingsWrite(ctx context.Context, in *SettingsWriteRequest, opts ...grpc.CallOption) (*SettingsWriteResponse, error) - // Deletes an entry and rewrites the file settings - SettingsDelete(ctx context.Context, in *SettingsDeleteRequest, opts ...grpc.CallOption) (*SettingsDeleteResponse, error) } type arduinoCoreServiceClient struct { @@ -1073,54 +1072,54 @@ func (c *arduinoCoreServiceClient) CleanDownloadCacheDirectory(ctx context.Conte return out, nil } -func (c *arduinoCoreServiceClient) SettingsGetAll(ctx context.Context, in *SettingsGetAllRequest, opts ...grpc.CallOption) (*SettingsGetAllResponse, error) { - out := new(SettingsGetAllResponse) - err := c.cc.Invoke(ctx, ArduinoCoreService_SettingsGetAll_FullMethodName, in, out, opts...) +func (c *arduinoCoreServiceClient) ConfigurationSave(ctx context.Context, in *ConfigurationSaveRequest, opts ...grpc.CallOption) (*ConfigurationSaveResponse, error) { + out := new(ConfigurationSaveResponse) + err := c.cc.Invoke(ctx, ArduinoCoreService_ConfigurationSave_FullMethodName, in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *arduinoCoreServiceClient) SettingsMerge(ctx context.Context, in *SettingsMergeRequest, opts ...grpc.CallOption) (*SettingsMergeResponse, error) { - out := new(SettingsMergeResponse) - err := c.cc.Invoke(ctx, ArduinoCoreService_SettingsMerge_FullMethodName, in, out, opts...) +func (c *arduinoCoreServiceClient) ConfigurationOpen(ctx context.Context, in *ConfigurationOpenRequest, opts ...grpc.CallOption) (*ConfigurationOpenResponse, error) { + out := new(ConfigurationOpenResponse) + err := c.cc.Invoke(ctx, ArduinoCoreService_ConfigurationOpen_FullMethodName, in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *arduinoCoreServiceClient) SettingsGetValue(ctx context.Context, in *SettingsGetValueRequest, opts ...grpc.CallOption) (*SettingsGetValueResponse, error) { - out := new(SettingsGetValueResponse) - err := c.cc.Invoke(ctx, ArduinoCoreService_SettingsGetValue_FullMethodName, in, out, opts...) +func (c *arduinoCoreServiceClient) ConfigurationGet(ctx context.Context, in *ConfigurationGetRequest, opts ...grpc.CallOption) (*ConfigurationGetResponse, error) { + out := new(ConfigurationGetResponse) + err := c.cc.Invoke(ctx, ArduinoCoreService_ConfigurationGet_FullMethodName, in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *arduinoCoreServiceClient) SettingsSetValue(ctx context.Context, in *SettingsSetValueRequest, opts ...grpc.CallOption) (*SettingsSetValueResponse, error) { - out := new(SettingsSetValueResponse) - err := c.cc.Invoke(ctx, ArduinoCoreService_SettingsSetValue_FullMethodName, in, out, opts...) +func (c *arduinoCoreServiceClient) SettingsEnumerate(ctx context.Context, in *SettingsEnumerateRequest, opts ...grpc.CallOption) (*SettingsEnumerateResponse, error) { + out := new(SettingsEnumerateResponse) + err := c.cc.Invoke(ctx, ArduinoCoreService_SettingsEnumerate_FullMethodName, in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *arduinoCoreServiceClient) SettingsWrite(ctx context.Context, in *SettingsWriteRequest, opts ...grpc.CallOption) (*SettingsWriteResponse, error) { - out := new(SettingsWriteResponse) - err := c.cc.Invoke(ctx, ArduinoCoreService_SettingsWrite_FullMethodName, in, out, opts...) +func (c *arduinoCoreServiceClient) SettingsGetValue(ctx context.Context, in *SettingsGetValueRequest, opts ...grpc.CallOption) (*SettingsGetValueResponse, error) { + out := new(SettingsGetValueResponse) + err := c.cc.Invoke(ctx, ArduinoCoreService_SettingsGetValue_FullMethodName, in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *arduinoCoreServiceClient) SettingsDelete(ctx context.Context, in *SettingsDeleteRequest, opts ...grpc.CallOption) (*SettingsDeleteResponse, error) { - out := new(SettingsDeleteResponse) - err := c.cc.Invoke(ctx, ArduinoCoreService_SettingsDelete_FullMethodName, in, out, opts...) +func (c *arduinoCoreServiceClient) SettingsSetValue(ctx context.Context, in *SettingsSetValueRequest, opts ...grpc.CallOption) (*SettingsSetValueResponse, error) { + out := new(SettingsSetValueResponse) + err := c.cc.Invoke(ctx, ArduinoCoreService_SettingsSetValue_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -1225,18 +1224,17 @@ type ArduinoCoreServiceServer interface { CheckForArduinoCLIUpdates(context.Context, *CheckForArduinoCLIUpdatesRequest) (*CheckForArduinoCLIUpdatesResponse, error) // Clean the download cache directory (where archives are downloaded). CleanDownloadCacheDirectory(context.Context, *CleanDownloadCacheDirectoryRequest) (*CleanDownloadCacheDirectoryResponse, error) - // List all the settings. - SettingsGetAll(context.Context, *SettingsGetAllRequest) (*SettingsGetAllResponse, error) - // Set multiple settings values at once. - SettingsMerge(context.Context, *SettingsMergeRequest) (*SettingsMergeResponse, error) - // Get the value of a specific setting. + // Writes the settings currently stored in memory in a YAML file + ConfigurationSave(context.Context, *ConfigurationSaveRequest) (*ConfigurationSaveResponse, error) + // Read the settings from a YAML file + ConfigurationOpen(context.Context, *ConfigurationOpenRequest) (*ConfigurationOpenResponse, error) + ConfigurationGet(context.Context, *ConfigurationGetRequest) (*ConfigurationGetResponse, error) + // Enumerate all the keys/values pairs available in the configuration + SettingsEnumerate(context.Context, *SettingsEnumerateRequest) (*SettingsEnumerateResponse, error) + // Get a single configuration value SettingsGetValue(context.Context, *SettingsGetValueRequest) (*SettingsGetValueResponse, error) - // Set the value of a specific setting. + // Set a single configuration value SettingsSetValue(context.Context, *SettingsSetValueRequest) (*SettingsSetValueResponse, error) - // Writes to file settings currently stored in memory - SettingsWrite(context.Context, *SettingsWriteRequest) (*SettingsWriteResponse, error) - // Deletes an entry and rewrites the file settings - SettingsDelete(context.Context, *SettingsDeleteRequest) (*SettingsDeleteResponse, error) mustEmbedUnimplementedArduinoCoreServiceServer() } @@ -1373,11 +1371,17 @@ func (UnimplementedArduinoCoreServiceServer) CheckForArduinoCLIUpdates(context.C func (UnimplementedArduinoCoreServiceServer) CleanDownloadCacheDirectory(context.Context, *CleanDownloadCacheDirectoryRequest) (*CleanDownloadCacheDirectoryResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CleanDownloadCacheDirectory not implemented") } -func (UnimplementedArduinoCoreServiceServer) SettingsGetAll(context.Context, *SettingsGetAllRequest) (*SettingsGetAllResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SettingsGetAll not implemented") +func (UnimplementedArduinoCoreServiceServer) ConfigurationSave(context.Context, *ConfigurationSaveRequest) (*ConfigurationSaveResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ConfigurationSave not implemented") +} +func (UnimplementedArduinoCoreServiceServer) ConfigurationOpen(context.Context, *ConfigurationOpenRequest) (*ConfigurationOpenResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ConfigurationOpen not implemented") +} +func (UnimplementedArduinoCoreServiceServer) ConfigurationGet(context.Context, *ConfigurationGetRequest) (*ConfigurationGetResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ConfigurationGet not implemented") } -func (UnimplementedArduinoCoreServiceServer) SettingsMerge(context.Context, *SettingsMergeRequest) (*SettingsMergeResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SettingsMerge not implemented") +func (UnimplementedArduinoCoreServiceServer) SettingsEnumerate(context.Context, *SettingsEnumerateRequest) (*SettingsEnumerateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SettingsEnumerate not implemented") } func (UnimplementedArduinoCoreServiceServer) SettingsGetValue(context.Context, *SettingsGetValueRequest) (*SettingsGetValueResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SettingsGetValue not implemented") @@ -1385,12 +1389,6 @@ func (UnimplementedArduinoCoreServiceServer) SettingsGetValue(context.Context, * func (UnimplementedArduinoCoreServiceServer) SettingsSetValue(context.Context, *SettingsSetValueRequest) (*SettingsSetValueResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SettingsSetValue not implemented") } -func (UnimplementedArduinoCoreServiceServer) SettingsWrite(context.Context, *SettingsWriteRequest) (*SettingsWriteResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SettingsWrite not implemented") -} -func (UnimplementedArduinoCoreServiceServer) SettingsDelete(context.Context, *SettingsDeleteRequest) (*SettingsDeleteResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SettingsDelete not implemented") -} func (UnimplementedArduinoCoreServiceServer) mustEmbedUnimplementedArduinoCoreServiceServer() {} // UnsafeArduinoCoreServiceServer may be embedded to opt out of forward compatibility for this service. @@ -2251,110 +2249,110 @@ func _ArduinoCoreService_CleanDownloadCacheDirectory_Handler(srv interface{}, ct return interceptor(ctx, in, info, handler) } -func _ArduinoCoreService_SettingsGetAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SettingsGetAllRequest) +func _ArduinoCoreService_ConfigurationSave_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ConfigurationSaveRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ArduinoCoreServiceServer).SettingsGetAll(ctx, in) + return srv.(ArduinoCoreServiceServer).ConfigurationSave(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: ArduinoCoreService_SettingsGetAll_FullMethodName, + FullMethod: ArduinoCoreService_ConfigurationSave_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ArduinoCoreServiceServer).SettingsGetAll(ctx, req.(*SettingsGetAllRequest)) + return srv.(ArduinoCoreServiceServer).ConfigurationSave(ctx, req.(*ConfigurationSaveRequest)) } return interceptor(ctx, in, info, handler) } -func _ArduinoCoreService_SettingsMerge_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SettingsMergeRequest) +func _ArduinoCoreService_ConfigurationOpen_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ConfigurationOpenRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ArduinoCoreServiceServer).SettingsMerge(ctx, in) + return srv.(ArduinoCoreServiceServer).ConfigurationOpen(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: ArduinoCoreService_SettingsMerge_FullMethodName, + FullMethod: ArduinoCoreService_ConfigurationOpen_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ArduinoCoreServiceServer).SettingsMerge(ctx, req.(*SettingsMergeRequest)) + return srv.(ArduinoCoreServiceServer).ConfigurationOpen(ctx, req.(*ConfigurationOpenRequest)) } return interceptor(ctx, in, info, handler) } -func _ArduinoCoreService_SettingsGetValue_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SettingsGetValueRequest) +func _ArduinoCoreService_ConfigurationGet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ConfigurationGetRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ArduinoCoreServiceServer).SettingsGetValue(ctx, in) + return srv.(ArduinoCoreServiceServer).ConfigurationGet(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: ArduinoCoreService_SettingsGetValue_FullMethodName, + FullMethod: ArduinoCoreService_ConfigurationGet_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ArduinoCoreServiceServer).SettingsGetValue(ctx, req.(*SettingsGetValueRequest)) + return srv.(ArduinoCoreServiceServer).ConfigurationGet(ctx, req.(*ConfigurationGetRequest)) } return interceptor(ctx, in, info, handler) } -func _ArduinoCoreService_SettingsSetValue_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SettingsSetValueRequest) +func _ArduinoCoreService_SettingsEnumerate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SettingsEnumerateRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ArduinoCoreServiceServer).SettingsSetValue(ctx, in) + return srv.(ArduinoCoreServiceServer).SettingsEnumerate(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: ArduinoCoreService_SettingsSetValue_FullMethodName, + FullMethod: ArduinoCoreService_SettingsEnumerate_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ArduinoCoreServiceServer).SettingsSetValue(ctx, req.(*SettingsSetValueRequest)) + return srv.(ArduinoCoreServiceServer).SettingsEnumerate(ctx, req.(*SettingsEnumerateRequest)) } return interceptor(ctx, in, info, handler) } -func _ArduinoCoreService_SettingsWrite_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SettingsWriteRequest) +func _ArduinoCoreService_SettingsGetValue_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SettingsGetValueRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ArduinoCoreServiceServer).SettingsWrite(ctx, in) + return srv.(ArduinoCoreServiceServer).SettingsGetValue(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: ArduinoCoreService_SettingsWrite_FullMethodName, + FullMethod: ArduinoCoreService_SettingsGetValue_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ArduinoCoreServiceServer).SettingsWrite(ctx, req.(*SettingsWriteRequest)) + return srv.(ArduinoCoreServiceServer).SettingsGetValue(ctx, req.(*SettingsGetValueRequest)) } return interceptor(ctx, in, info, handler) } -func _ArduinoCoreService_SettingsDelete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SettingsDeleteRequest) +func _ArduinoCoreService_SettingsSetValue_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SettingsSetValueRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ArduinoCoreServiceServer).SettingsDelete(ctx, in) + return srv.(ArduinoCoreServiceServer).SettingsSetValue(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: ArduinoCoreService_SettingsDelete_FullMethodName, + FullMethod: ArduinoCoreService_SettingsSetValue_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ArduinoCoreServiceServer).SettingsDelete(ctx, req.(*SettingsDeleteRequest)) + return srv.(ArduinoCoreServiceServer).SettingsSetValue(ctx, req.(*SettingsSetValueRequest)) } return interceptor(ctx, in, info, handler) } @@ -2455,28 +2453,28 @@ var ArduinoCoreService_ServiceDesc = grpc.ServiceDesc{ Handler: _ArduinoCoreService_CleanDownloadCacheDirectory_Handler, }, { - MethodName: "SettingsGetAll", - Handler: _ArduinoCoreService_SettingsGetAll_Handler, + MethodName: "ConfigurationSave", + Handler: _ArduinoCoreService_ConfigurationSave_Handler, }, { - MethodName: "SettingsMerge", - Handler: _ArduinoCoreService_SettingsMerge_Handler, + MethodName: "ConfigurationOpen", + Handler: _ArduinoCoreService_ConfigurationOpen_Handler, }, { - MethodName: "SettingsGetValue", - Handler: _ArduinoCoreService_SettingsGetValue_Handler, + MethodName: "ConfigurationGet", + Handler: _ArduinoCoreService_ConfigurationGet_Handler, }, { - MethodName: "SettingsSetValue", - Handler: _ArduinoCoreService_SettingsSetValue_Handler, + MethodName: "SettingsEnumerate", + Handler: _ArduinoCoreService_SettingsEnumerate_Handler, }, { - MethodName: "SettingsWrite", - Handler: _ArduinoCoreService_SettingsWrite_Handler, + MethodName: "SettingsGetValue", + Handler: _ArduinoCoreService_SettingsGetValue_Handler, }, { - MethodName: "SettingsDelete", - Handler: _ArduinoCoreService_SettingsDelete_Handler, + MethodName: "SettingsSetValue", + Handler: _ArduinoCoreService_SettingsSetValue_Handler, }, }, Streams: []grpc.StreamDesc{ diff --git a/rpc/cc/arduino/cli/commands/v1/settings.pb.go b/rpc/cc/arduino/cli/commands/v1/settings.pb.go index 8a594bbd49f..fbfa2a11674 100644 --- a/rpc/cc/arduino/cli/commands/v1/settings.pb.go +++ b/rpc/cc/arduino/cli/commands/v1/settings.pb.go @@ -35,17 +35,28 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -type SettingsGetAllResponse struct { +// Configuration to apply to the given instance. +// Any missing field will be kept at the default value. +type Configuration struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // The settings, in JSON format. - JsonData string `protobuf:"bytes,1,opt,name=json_data,json=jsonData,proto3" json:"json_data,omitempty"` -} - -func (x *SettingsGetAllResponse) Reset() { - *x = SettingsGetAllResponse{} + Directories *Configuration_Directories `protobuf:"bytes,1,opt,name=directories,proto3" json:"directories,omitempty"` + Network *Configuration_Network `protobuf:"bytes,2,opt,name=network,proto3" json:"network,omitempty"` + Sketch *Configuration_Sketch `protobuf:"bytes,3,opt,name=sketch,proto3" json:"sketch,omitempty"` + BuildCache *Configuration_BuildCache `protobuf:"bytes,4,opt,name=build_cache,json=buildCache,proto3" json:"build_cache,omitempty"` + BoardManager *Configuration_BoardManager `protobuf:"bytes,5,opt,name=board_manager,json=boardManager,proto3" json:"board_manager,omitempty"` + Daemon *Configuration_Daemon `protobuf:"bytes,6,opt,name=daemon,proto3" json:"daemon,omitempty"` + Output *Configuration_Output `protobuf:"bytes,7,opt,name=output,proto3" json:"output,omitempty"` + Logging *Configuration_Logging `protobuf:"bytes,8,opt,name=logging,proto3" json:"logging,omitempty"` + Library *Configuration_Library `protobuf:"bytes,9,opt,name=library,proto3" json:"library,omitempty"` + Updater *Configuration_Updater `protobuf:"bytes,10,opt,name=updater,proto3" json:"updater,omitempty"` + Locale *string `protobuf:"bytes,100,opt,name=locale,proto3,oneof" json:"locale,omitempty"` +} + +func (x *Configuration) Reset() { + *x = Configuration{} if protoimpl.UnsafeEnabled { mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -53,13 +64,13 @@ func (x *SettingsGetAllResponse) Reset() { } } -func (x *SettingsGetAllResponse) String() string { +func (x *Configuration) String() string { return protoimpl.X.MessageStringOf(x) } -func (*SettingsGetAllResponse) ProtoMessage() {} +func (*Configuration) ProtoMessage() {} -func (x *SettingsGetAllResponse) ProtoReflect() protoreflect.Message { +func (x *Configuration) ProtoReflect() protoreflect.Message { mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -71,29 +82,96 @@ func (x *SettingsGetAllResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use SettingsGetAllResponse.ProtoReflect.Descriptor instead. -func (*SettingsGetAllResponse) Descriptor() ([]byte, []int) { +// Deprecated: Use Configuration.ProtoReflect.Descriptor instead. +func (*Configuration) Descriptor() ([]byte, []int) { return file_cc_arduino_cli_commands_v1_settings_proto_rawDescGZIP(), []int{0} } -func (x *SettingsGetAllResponse) GetJsonData() string { +func (x *Configuration) GetDirectories() *Configuration_Directories { + if x != nil { + return x.Directories + } + return nil +} + +func (x *Configuration) GetNetwork() *Configuration_Network { + if x != nil { + return x.Network + } + return nil +} + +func (x *Configuration) GetSketch() *Configuration_Sketch { + if x != nil { + return x.Sketch + } + return nil +} + +func (x *Configuration) GetBuildCache() *Configuration_BuildCache { + if x != nil { + return x.BuildCache + } + return nil +} + +func (x *Configuration) GetBoardManager() *Configuration_BoardManager { + if x != nil { + return x.BoardManager + } + return nil +} + +func (x *Configuration) GetDaemon() *Configuration_Daemon { + if x != nil { + return x.Daemon + } + return nil +} + +func (x *Configuration) GetOutput() *Configuration_Output { + if x != nil { + return x.Output + } + return nil +} + +func (x *Configuration) GetLogging() *Configuration_Logging { + if x != nil { + return x.Logging + } + return nil +} + +func (x *Configuration) GetLibrary() *Configuration_Library { + if x != nil { + return x.Library + } + return nil +} + +func (x *Configuration) GetUpdater() *Configuration_Updater { if x != nil { - return x.JsonData + return x.Updater + } + return nil +} + +func (x *Configuration) GetLocale() string { + if x != nil && x.Locale != nil { + return *x.Locale } return "" } -type SettingsMergeRequest struct { +type ConfigurationGetRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - - // The settings, in JSON format. - JsonData string `protobuf:"bytes,1,opt,name=json_data,json=jsonData,proto3" json:"json_data,omitempty"` } -func (x *SettingsMergeRequest) Reset() { - *x = SettingsMergeRequest{} +func (x *ConfigurationGetRequest) Reset() { + *x = ConfigurationGetRequest{} if protoimpl.UnsafeEnabled { mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -101,13 +179,13 @@ func (x *SettingsMergeRequest) Reset() { } } -func (x *SettingsMergeRequest) String() string { +func (x *ConfigurationGetRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*SettingsMergeRequest) ProtoMessage() {} +func (*ConfigurationGetRequest) ProtoMessage() {} -func (x *SettingsMergeRequest) ProtoReflect() protoreflect.Message { +func (x *ConfigurationGetRequest) ProtoReflect() protoreflect.Message { mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -119,46 +197,272 @@ func (x *SettingsMergeRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use SettingsMergeRequest.ProtoReflect.Descriptor instead. -func (*SettingsMergeRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use ConfigurationGetRequest.ProtoReflect.Descriptor instead. +func (*ConfigurationGetRequest) Descriptor() ([]byte, []int) { return file_cc_arduino_cli_commands_v1_settings_proto_rawDescGZIP(), []int{1} } -func (x *SettingsMergeRequest) GetJsonData() string { +type ConfigurationGetResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The current configuration + Configuration *Configuration `protobuf:"bytes,1,opt,name=configuration,proto3" json:"configuration,omitempty"` +} + +func (x *ConfigurationGetResponse) Reset() { + *x = ConfigurationGetResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ConfigurationGetResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConfigurationGetResponse) ProtoMessage() {} + +func (x *ConfigurationGetResponse) ProtoReflect() protoreflect.Message { + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConfigurationGetResponse.ProtoReflect.Descriptor instead. +func (*ConfigurationGetResponse) Descriptor() ([]byte, []int) { + return file_cc_arduino_cli_commands_v1_settings_proto_rawDescGZIP(), []int{2} +} + +func (x *ConfigurationGetResponse) GetConfiguration() *Configuration { + if x != nil { + return x.Configuration + } + return nil +} + +type ConfigurationSaveRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Format string `protobuf:"bytes,1,opt,name=format,proto3" json:"format,omitempty"` +} + +func (x *ConfigurationSaveRequest) Reset() { + *x = ConfigurationSaveRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ConfigurationSaveRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConfigurationSaveRequest) ProtoMessage() {} + +func (x *ConfigurationSaveRequest) ProtoReflect() protoreflect.Message { + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConfigurationSaveRequest.ProtoReflect.Descriptor instead. +func (*ConfigurationSaveRequest) Descriptor() ([]byte, []int) { + return file_cc_arduino_cli_commands_v1_settings_proto_rawDescGZIP(), []int{3} +} + +func (x *ConfigurationSaveRequest) GetFormat() string { if x != nil { - return x.JsonData + return x.Format } return "" } -type SettingsGetValueResponse struct { +type ConfigurationSaveResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + EncodedSettings string `protobuf:"bytes,1,opt,name=encoded_settings,json=encodedSettings,proto3" json:"encoded_settings,omitempty"` +} + +func (x *ConfigurationSaveResponse) Reset() { + *x = ConfigurationSaveResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ConfigurationSaveResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConfigurationSaveResponse) ProtoMessage() {} + +func (x *ConfigurationSaveResponse) ProtoReflect() protoreflect.Message { + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConfigurationSaveResponse.ProtoReflect.Descriptor instead. +func (*ConfigurationSaveResponse) Descriptor() ([]byte, []int) { + return file_cc_arduino_cli_commands_v1_settings_proto_rawDescGZIP(), []int{4} +} + +func (x *ConfigurationSaveResponse) GetEncodedSettings() string { + if x != nil { + return x.EncodedSettings + } + return "" +} + +type ConfigurationOpenRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Format string `protobuf:"bytes,1,opt,name=format,proto3" json:"format,omitempty"` + EncodedSettings string `protobuf:"bytes,2,opt,name=encoded_settings,json=encodedSettings,proto3" json:"encoded_settings,omitempty"` +} + +func (x *ConfigurationOpenRequest) Reset() { + *x = ConfigurationOpenRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ConfigurationOpenRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConfigurationOpenRequest) ProtoMessage() {} + +func (x *ConfigurationOpenRequest) ProtoReflect() protoreflect.Message { + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConfigurationOpenRequest.ProtoReflect.Descriptor instead. +func (*ConfigurationOpenRequest) Descriptor() ([]byte, []int) { + return file_cc_arduino_cli_commands_v1_settings_proto_rawDescGZIP(), []int{5} +} + +func (x *ConfigurationOpenRequest) GetFormat() string { + if x != nil { + return x.Format + } + return "" +} + +func (x *ConfigurationOpenRequest) GetEncodedSettings() string { + if x != nil { + return x.EncodedSettings + } + return "" +} + +type ConfigurationOpenResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ConfigurationOpenResponse) Reset() { + *x = ConfigurationOpenResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ConfigurationOpenResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConfigurationOpenResponse) ProtoMessage() {} + +func (x *ConfigurationOpenResponse) ProtoReflect() protoreflect.Message { + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConfigurationOpenResponse.ProtoReflect.Descriptor instead. +func (*ConfigurationOpenResponse) Descriptor() ([]byte, []int) { + return file_cc_arduino_cli_commands_v1_settings_proto_rawDescGZIP(), []int{6} +} + +type SettingsGetValueRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // The key of the setting. + // The key to get Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - // The setting, in JSON format. - JsonData string `protobuf:"bytes,2,opt,name=json_data,json=jsonData,proto3" json:"json_data,omitempty"` } -func (x *SettingsGetValueResponse) Reset() { - *x = SettingsGetValueResponse{} +func (x *SettingsGetValueRequest) Reset() { + *x = SettingsGetValueRequest{} if protoimpl.UnsafeEnabled { - mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[2] + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *SettingsGetValueResponse) String() string { +func (x *SettingsGetValueRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*SettingsGetValueResponse) ProtoMessage() {} +func (*SettingsGetValueRequest) ProtoMessage() {} -func (x *SettingsGetValueResponse) ProtoReflect() protoreflect.Message { - mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[2] +func (x *SettingsGetValueRequest) ProtoReflect() protoreflect.Message { + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -169,53 +473,456 @@ func (x *SettingsGetValueResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use SettingsGetValueResponse.ProtoReflect.Descriptor instead. -func (*SettingsGetValueResponse) Descriptor() ([]byte, []int) { - return file_cc_arduino_cli_commands_v1_settings_proto_rawDescGZIP(), []int{2} +// Deprecated: Use SettingsGetValueRequest.ProtoReflect.Descriptor instead. +func (*SettingsGetValueRequest) Descriptor() ([]byte, []int) { + return file_cc_arduino_cli_commands_v1_settings_proto_rawDescGZIP(), []int{7} +} + +func (x *SettingsGetValueRequest) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +type SettingsGetValueResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The value of the key as a JSON string (no objects, only scalar or array of + // scalars are allowed) + ValueJson string `protobuf:"bytes,1,opt,name=value_json,json=valueJson,proto3" json:"value_json,omitempty"` +} + +func (x *SettingsGetValueResponse) Reset() { + *x = SettingsGetValueResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SettingsGetValueResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SettingsGetValueResponse) ProtoMessage() {} + +func (x *SettingsGetValueResponse) ProtoReflect() protoreflect.Message { + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SettingsGetValueResponse.ProtoReflect.Descriptor instead. +func (*SettingsGetValueResponse) Descriptor() ([]byte, []int) { + return file_cc_arduino_cli_commands_v1_settings_proto_rawDescGZIP(), []int{8} +} + +func (x *SettingsGetValueResponse) GetValueJson() string { + if x != nil { + return x.ValueJson + } + return "" +} + +type SettingsSetValueRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The key to change + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // The new value (no objects, only scalar or array of scalars are allowed) + ValueJson string `protobuf:"bytes,2,opt,name=value_json,json=valueJson,proto3" json:"value_json,omitempty"` +} + +func (x *SettingsSetValueRequest) Reset() { + *x = SettingsSetValueRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SettingsSetValueRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SettingsSetValueRequest) ProtoMessage() {} + +func (x *SettingsSetValueRequest) ProtoReflect() protoreflect.Message { + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SettingsSetValueRequest.ProtoReflect.Descriptor instead. +func (*SettingsSetValueRequest) Descriptor() ([]byte, []int) { + return file_cc_arduino_cli_commands_v1_settings_proto_rawDescGZIP(), []int{9} +} + +func (x *SettingsSetValueRequest) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *SettingsSetValueRequest) GetValueJson() string { + if x != nil { + return x.ValueJson + } + return "" +} + +type SettingsSetValueResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *SettingsSetValueResponse) Reset() { + *x = SettingsSetValueResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SettingsSetValueResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SettingsSetValueResponse) ProtoMessage() {} + +func (x *SettingsSetValueResponse) ProtoReflect() protoreflect.Message { + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SettingsSetValueResponse.ProtoReflect.Descriptor instead. +func (*SettingsSetValueResponse) Descriptor() ([]byte, []int) { + return file_cc_arduino_cli_commands_v1_settings_proto_rawDescGZIP(), []int{10} +} + +type SettingsEnumerateRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *SettingsEnumerateRequest) Reset() { + *x = SettingsEnumerateRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SettingsEnumerateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SettingsEnumerateRequest) ProtoMessage() {} + +func (x *SettingsEnumerateRequest) ProtoReflect() protoreflect.Message { + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SettingsEnumerateRequest.ProtoReflect.Descriptor instead. +func (*SettingsEnumerateRequest) Descriptor() ([]byte, []int) { + return file_cc_arduino_cli_commands_v1_settings_proto_rawDescGZIP(), []int{11} +} + +type SettingsEnumerateResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The list of key/value pairs + Entries []*SettingsEnumerateResponse_Entry `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"` +} + +func (x *SettingsEnumerateResponse) Reset() { + *x = SettingsEnumerateResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SettingsEnumerateResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SettingsEnumerateResponse) ProtoMessage() {} + +func (x *SettingsEnumerateResponse) ProtoReflect() protoreflect.Message { + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SettingsEnumerateResponse.ProtoReflect.Descriptor instead. +func (*SettingsEnumerateResponse) Descriptor() ([]byte, []int) { + return file_cc_arduino_cli_commands_v1_settings_proto_rawDescGZIP(), []int{12} +} + +func (x *SettingsEnumerateResponse) GetEntries() []*SettingsEnumerateResponse_Entry { + if x != nil { + return x.Entries + } + return nil +} + +type Configuration_Directories struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Data directory + Data *string `protobuf:"bytes,1,opt,name=data,proto3,oneof" json:"data,omitempty"` + // User directory + User *string `protobuf:"bytes,2,opt,name=user,proto3,oneof" json:"user,omitempty"` + // Downloads directory + Downloads *string `protobuf:"bytes,3,opt,name=downloads,proto3,oneof" json:"downloads,omitempty"` + // The directory where the built-in resources are installed + Builtin *Configuration_Directories_Builtin `protobuf:"bytes,4,opt,name=builtin,proto3,oneof" json:"builtin,omitempty"` +} + +func (x *Configuration_Directories) Reset() { + *x = Configuration_Directories{} + if protoimpl.UnsafeEnabled { + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Configuration_Directories) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Configuration_Directories) ProtoMessage() {} + +func (x *Configuration_Directories) ProtoReflect() protoreflect.Message { + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Configuration_Directories.ProtoReflect.Descriptor instead. +func (*Configuration_Directories) Descriptor() ([]byte, []int) { + return file_cc_arduino_cli_commands_v1_settings_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *Configuration_Directories) GetData() string { + if x != nil && x.Data != nil { + return *x.Data + } + return "" +} + +func (x *Configuration_Directories) GetUser() string { + if x != nil && x.User != nil { + return *x.User + } + return "" +} + +func (x *Configuration_Directories) GetDownloads() string { + if x != nil && x.Downloads != nil { + return *x.Downloads + } + return "" +} + +func (x *Configuration_Directories) GetBuiltin() *Configuration_Directories_Builtin { + if x != nil { + return x.Builtin + } + return nil +} + +type Configuration_Network struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Extra user-agent information to be appended in network requests + ExtraUserAgent *string `protobuf:"bytes,1,opt,name=extra_user_agent,json=extraUserAgent,proto3,oneof" json:"extra_user_agent,omitempty"` + // The proxy to use for network requests + Proxy *string `protobuf:"bytes,2,opt,name=proxy,proto3,oneof" json:"proxy,omitempty"` +} + +func (x *Configuration_Network) Reset() { + *x = Configuration_Network{} + if protoimpl.UnsafeEnabled { + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Configuration_Network) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Configuration_Network) ProtoMessage() {} + +func (x *Configuration_Network) ProtoReflect() protoreflect.Message { + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Configuration_Network.ProtoReflect.Descriptor instead. +func (*Configuration_Network) Descriptor() ([]byte, []int) { + return file_cc_arduino_cli_commands_v1_settings_proto_rawDescGZIP(), []int{0, 1} +} + +func (x *Configuration_Network) GetExtraUserAgent() string { + if x != nil && x.ExtraUserAgent != nil { + return *x.ExtraUserAgent + } + return "" +} + +func (x *Configuration_Network) GetProxy() string { + if x != nil && x.Proxy != nil { + return *x.Proxy + } + return "" +} + +type Configuration_Sketch struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Set to true to always export binaries to the sketch directory + AlwaysExportBinaries *bool `protobuf:"varint,1,opt,name=always_export_binaries,json=alwaysExportBinaries,proto3,oneof" json:"always_export_binaries,omitempty"` +} + +func (x *Configuration_Sketch) Reset() { + *x = Configuration_Sketch{} + if protoimpl.UnsafeEnabled { + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Configuration_Sketch) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Configuration_Sketch) ProtoMessage() {} + +func (x *Configuration_Sketch) ProtoReflect() protoreflect.Message { + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -func (x *SettingsGetValueResponse) GetKey() string { - if x != nil { - return x.Key - } - return "" +// Deprecated: Use Configuration_Sketch.ProtoReflect.Descriptor instead. +func (*Configuration_Sketch) Descriptor() ([]byte, []int) { + return file_cc_arduino_cli_commands_v1_settings_proto_rawDescGZIP(), []int{0, 2} } -func (x *SettingsGetValueResponse) GetJsonData() string { - if x != nil { - return x.JsonData +func (x *Configuration_Sketch) GetAlwaysExportBinaries() bool { + if x != nil && x.AlwaysExportBinaries != nil { + return *x.AlwaysExportBinaries } - return "" + return false } -type SettingsSetValueRequest struct { +type Configuration_BuildCache struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // The key of the setting. - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - // The setting, in JSON format. - JsonData string `protobuf:"bytes,2,opt,name=json_data,json=jsonData,proto3" json:"json_data,omitempty"` + // The minimum number of compilations before the cache is purged + CompilationsBeforePurge *uint32 `protobuf:"varint,1,opt,name=compilations_before_purge,json=compilationsBeforePurge,proto3,oneof" json:"compilations_before_purge,omitempty"` + // Time to live of the cache in seconds + TtlSecs *uint64 `protobuf:"varint,2,opt,name=ttl_secs,json=ttlSecs,proto3,oneof" json:"ttl_secs,omitempty"` } -func (x *SettingsSetValueRequest) Reset() { - *x = SettingsSetValueRequest{} +func (x *Configuration_BuildCache) Reset() { + *x = Configuration_BuildCache{} if protoimpl.UnsafeEnabled { - mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[3] + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *SettingsSetValueRequest) String() string { +func (x *Configuration_BuildCache) String() string { return protoimpl.X.MessageStringOf(x) } -func (*SettingsSetValueRequest) ProtoMessage() {} +func (*Configuration_BuildCache) ProtoMessage() {} -func (x *SettingsSetValueRequest) ProtoReflect() protoreflect.Message { - mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[3] +func (x *Configuration_BuildCache) ProtoReflect() protoreflect.Message { + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -226,48 +933,51 @@ func (x *SettingsSetValueRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use SettingsSetValueRequest.ProtoReflect.Descriptor instead. -func (*SettingsSetValueRequest) Descriptor() ([]byte, []int) { - return file_cc_arduino_cli_commands_v1_settings_proto_rawDescGZIP(), []int{3} +// Deprecated: Use Configuration_BuildCache.ProtoReflect.Descriptor instead. +func (*Configuration_BuildCache) Descriptor() ([]byte, []int) { + return file_cc_arduino_cli_commands_v1_settings_proto_rawDescGZIP(), []int{0, 3} } -func (x *SettingsSetValueRequest) GetKey() string { - if x != nil { - return x.Key +func (x *Configuration_BuildCache) GetCompilationsBeforePurge() uint32 { + if x != nil && x.CompilationsBeforePurge != nil { + return *x.CompilationsBeforePurge } - return "" + return 0 } -func (x *SettingsSetValueRequest) GetJsonData() string { - if x != nil { - return x.JsonData +func (x *Configuration_BuildCache) GetTtlSecs() uint64 { + if x != nil && x.TtlSecs != nil { + return *x.TtlSecs } - return "" + return 0 } -type SettingsGetAllRequest struct { +type Configuration_BoardManager struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + // Additional URLs to be used for the board manager + AdditionalUrls []string `protobuf:"bytes,1,rep,name=additional_urls,json=additionalUrls,proto3" json:"additional_urls,omitempty"` } -func (x *SettingsGetAllRequest) Reset() { - *x = SettingsGetAllRequest{} +func (x *Configuration_BoardManager) Reset() { + *x = Configuration_BoardManager{} if protoimpl.UnsafeEnabled { - mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[4] + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *SettingsGetAllRequest) String() string { +func (x *Configuration_BoardManager) String() string { return protoimpl.X.MessageStringOf(x) } -func (*SettingsGetAllRequest) ProtoMessage() {} +func (*Configuration_BoardManager) ProtoMessage() {} -func (x *SettingsGetAllRequest) ProtoReflect() protoreflect.Message { - mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[4] +func (x *Configuration_BoardManager) ProtoReflect() protoreflect.Message { + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[17] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -278,37 +988,44 @@ func (x *SettingsGetAllRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use SettingsGetAllRequest.ProtoReflect.Descriptor instead. -func (*SettingsGetAllRequest) Descriptor() ([]byte, []int) { - return file_cc_arduino_cli_commands_v1_settings_proto_rawDescGZIP(), []int{4} +// Deprecated: Use Configuration_BoardManager.ProtoReflect.Descriptor instead. +func (*Configuration_BoardManager) Descriptor() ([]byte, []int) { + return file_cc_arduino_cli_commands_v1_settings_proto_rawDescGZIP(), []int{0, 4} } -type SettingsGetValueRequest struct { +func (x *Configuration_BoardManager) GetAdditionalUrls() []string { + if x != nil { + return x.AdditionalUrls + } + return nil +} + +type Configuration_Daemon struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // The key of the setting. - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // The TCP port of the daemon + Port *string `protobuf:"bytes,1,opt,name=port,proto3,oneof" json:"port,omitempty"` } -func (x *SettingsGetValueRequest) Reset() { - *x = SettingsGetValueRequest{} +func (x *Configuration_Daemon) Reset() { + *x = Configuration_Daemon{} if protoimpl.UnsafeEnabled { - mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[5] + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *SettingsGetValueRequest) String() string { +func (x *Configuration_Daemon) String() string { return protoimpl.X.MessageStringOf(x) } -func (*SettingsGetValueRequest) ProtoMessage() {} +func (*Configuration_Daemon) ProtoMessage() {} -func (x *SettingsGetValueRequest) ProtoReflect() protoreflect.Message { - mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[5] +func (x *Configuration_Daemon) ProtoReflect() protoreflect.Message { + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[18] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -319,41 +1036,44 @@ func (x *SettingsGetValueRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use SettingsGetValueRequest.ProtoReflect.Descriptor instead. -func (*SettingsGetValueRequest) Descriptor() ([]byte, []int) { - return file_cc_arduino_cli_commands_v1_settings_proto_rawDescGZIP(), []int{5} +// Deprecated: Use Configuration_Daemon.ProtoReflect.Descriptor instead. +func (*Configuration_Daemon) Descriptor() ([]byte, []int) { + return file_cc_arduino_cli_commands_v1_settings_proto_rawDescGZIP(), []int{0, 5} } -func (x *SettingsGetValueRequest) GetKey() string { - if x != nil { - return x.Key +func (x *Configuration_Daemon) GetPort() string { + if x != nil && x.Port != nil { + return *x.Port } return "" } -type SettingsMergeResponse struct { +type Configuration_Output struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + // Set to true to disable coloring of the output + NoColor *bool `protobuf:"varint,1,opt,name=no_color,json=noColor,proto3,oneof" json:"no_color,omitempty"` } -func (x *SettingsMergeResponse) Reset() { - *x = SettingsMergeResponse{} +func (x *Configuration_Output) Reset() { + *x = Configuration_Output{} if protoimpl.UnsafeEnabled { - mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[6] + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *SettingsMergeResponse) String() string { +func (x *Configuration_Output) String() string { return protoimpl.X.MessageStringOf(x) } -func (*SettingsMergeResponse) ProtoMessage() {} +func (*Configuration_Output) ProtoMessage() {} -func (x *SettingsMergeResponse) ProtoReflect() protoreflect.Message { - mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[6] +func (x *Configuration_Output) ProtoReflect() protoreflect.Message { + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[19] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -364,34 +1084,48 @@ func (x *SettingsMergeResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use SettingsMergeResponse.ProtoReflect.Descriptor instead. -func (*SettingsMergeResponse) Descriptor() ([]byte, []int) { - return file_cc_arduino_cli_commands_v1_settings_proto_rawDescGZIP(), []int{6} +// Deprecated: Use Configuration_Output.ProtoReflect.Descriptor instead. +func (*Configuration_Output) Descriptor() ([]byte, []int) { + return file_cc_arduino_cli_commands_v1_settings_proto_rawDescGZIP(), []int{0, 6} } -type SettingsSetValueResponse struct { +func (x *Configuration_Output) GetNoColor() bool { + if x != nil && x.NoColor != nil { + return *x.NoColor + } + return false +} + +type Configuration_Logging struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + // The logging level + Level *string `protobuf:"bytes,1,opt,name=level,proto3,oneof" json:"level,omitempty"` + // The logging format + Format *string `protobuf:"bytes,2,opt,name=format,proto3,oneof" json:"format,omitempty"` + // The logging file + File *string `protobuf:"bytes,3,opt,name=file,proto3,oneof" json:"file,omitempty"` } -func (x *SettingsSetValueResponse) Reset() { - *x = SettingsSetValueResponse{} +func (x *Configuration_Logging) Reset() { + *x = Configuration_Logging{} if protoimpl.UnsafeEnabled { - mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[7] + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *SettingsSetValueResponse) String() string { +func (x *Configuration_Logging) String() string { return protoimpl.X.MessageStringOf(x) } -func (*SettingsSetValueResponse) ProtoMessage() {} +func (*Configuration_Logging) ProtoMessage() {} -func (x *SettingsSetValueResponse) ProtoReflect() protoreflect.Message { - mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[7] +func (x *Configuration_Logging) ProtoReflect() protoreflect.Message { + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[20] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -402,37 +1136,59 @@ func (x *SettingsSetValueResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use SettingsSetValueResponse.ProtoReflect.Descriptor instead. -func (*SettingsSetValueResponse) Descriptor() ([]byte, []int) { - return file_cc_arduino_cli_commands_v1_settings_proto_rawDescGZIP(), []int{7} +// Deprecated: Use Configuration_Logging.ProtoReflect.Descriptor instead. +func (*Configuration_Logging) Descriptor() ([]byte, []int) { + return file_cc_arduino_cli_commands_v1_settings_proto_rawDescGZIP(), []int{0, 7} +} + +func (x *Configuration_Logging) GetLevel() string { + if x != nil && x.Level != nil { + return *x.Level + } + return "" +} + +func (x *Configuration_Logging) GetFormat() string { + if x != nil && x.Format != nil { + return *x.Format + } + return "" +} + +func (x *Configuration_Logging) GetFile() string { + if x != nil && x.File != nil { + return *x.File + } + return "" } -type SettingsWriteRequest struct { +type Configuration_Library struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Path to settings file (e.g. /path/to/arduino-cli.yaml) - FilePath string `protobuf:"bytes,1,opt,name=file_path,json=filePath,proto3" json:"file_path,omitempty"` + // Set to true to enable library installation from zip archives or git + // repositories + EnableUnsafeInstall *bool `protobuf:"varint,1,opt,name=enable_unsafe_install,json=enableUnsafeInstall,proto3,oneof" json:"enable_unsafe_install,omitempty"` } -func (x *SettingsWriteRequest) Reset() { - *x = SettingsWriteRequest{} +func (x *Configuration_Library) Reset() { + *x = Configuration_Library{} if protoimpl.UnsafeEnabled { - mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[8] + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *SettingsWriteRequest) String() string { +func (x *Configuration_Library) String() string { return protoimpl.X.MessageStringOf(x) } -func (*SettingsWriteRequest) ProtoMessage() {} +func (*Configuration_Library) ProtoMessage() {} -func (x *SettingsWriteRequest) ProtoReflect() protoreflect.Message { - mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[8] +func (x *Configuration_Library) ProtoReflect() protoreflect.Message { + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[21] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -443,41 +1199,44 @@ func (x *SettingsWriteRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use SettingsWriteRequest.ProtoReflect.Descriptor instead. -func (*SettingsWriteRequest) Descriptor() ([]byte, []int) { - return file_cc_arduino_cli_commands_v1_settings_proto_rawDescGZIP(), []int{8} +// Deprecated: Use Configuration_Library.ProtoReflect.Descriptor instead. +func (*Configuration_Library) Descriptor() ([]byte, []int) { + return file_cc_arduino_cli_commands_v1_settings_proto_rawDescGZIP(), []int{0, 8} } -func (x *SettingsWriteRequest) GetFilePath() string { - if x != nil { - return x.FilePath +func (x *Configuration_Library) GetEnableUnsafeInstall() bool { + if x != nil && x.EnableUnsafeInstall != nil { + return *x.EnableUnsafeInstall } - return "" + return false } -type SettingsWriteResponse struct { +type Configuration_Updater struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + // Set to true to enable notifications for updates + EnableNotification *bool `protobuf:"varint,1,opt,name=enable_notification,json=enableNotification,proto3,oneof" json:"enable_notification,omitempty"` } -func (x *SettingsWriteResponse) Reset() { - *x = SettingsWriteResponse{} +func (x *Configuration_Updater) Reset() { + *x = Configuration_Updater{} if protoimpl.UnsafeEnabled { - mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[9] + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *SettingsWriteResponse) String() string { +func (x *Configuration_Updater) String() string { return protoimpl.X.MessageStringOf(x) } -func (*SettingsWriteResponse) ProtoMessage() {} +func (*Configuration_Updater) ProtoMessage() {} -func (x *SettingsWriteResponse) ProtoReflect() protoreflect.Message { - mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[9] +func (x *Configuration_Updater) ProtoReflect() protoreflect.Message { + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[22] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -488,37 +1247,46 @@ func (x *SettingsWriteResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use SettingsWriteResponse.ProtoReflect.Descriptor instead. -func (*SettingsWriteResponse) Descriptor() ([]byte, []int) { - return file_cc_arduino_cli_commands_v1_settings_proto_rawDescGZIP(), []int{9} +// Deprecated: Use Configuration_Updater.ProtoReflect.Descriptor instead. +func (*Configuration_Updater) Descriptor() ([]byte, []int) { + return file_cc_arduino_cli_commands_v1_settings_proto_rawDescGZIP(), []int{0, 9} } -type SettingsDeleteRequest struct { +func (x *Configuration_Updater) GetEnableNotification() bool { + if x != nil && x.EnableNotification != nil { + return *x.EnableNotification + } + return false +} + +type Configuration_Directories_Builtin struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // The key of the setting to delete. - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // The directory where the built-in tools are installed + Tools *string `protobuf:"bytes,1,opt,name=tools,proto3,oneof" json:"tools,omitempty"` + // The directory where the built-in libraries are installed + Libraries *string `protobuf:"bytes,2,opt,name=libraries,proto3,oneof" json:"libraries,omitempty"` } -func (x *SettingsDeleteRequest) Reset() { - *x = SettingsDeleteRequest{} +func (x *Configuration_Directories_Builtin) Reset() { + *x = Configuration_Directories_Builtin{} if protoimpl.UnsafeEnabled { - mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[10] + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *SettingsDeleteRequest) String() string { +func (x *Configuration_Directories_Builtin) String() string { return protoimpl.X.MessageStringOf(x) } -func (*SettingsDeleteRequest) ProtoMessage() {} +func (*Configuration_Directories_Builtin) ProtoMessage() {} -func (x *SettingsDeleteRequest) ProtoReflect() protoreflect.Message { - mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[10] +func (x *Configuration_Directories_Builtin) ProtoReflect() protoreflect.Message { + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[23] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -529,41 +1297,53 @@ func (x *SettingsDeleteRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use SettingsDeleteRequest.ProtoReflect.Descriptor instead. -func (*SettingsDeleteRequest) Descriptor() ([]byte, []int) { - return file_cc_arduino_cli_commands_v1_settings_proto_rawDescGZIP(), []int{10} +// Deprecated: Use Configuration_Directories_Builtin.ProtoReflect.Descriptor instead. +func (*Configuration_Directories_Builtin) Descriptor() ([]byte, []int) { + return file_cc_arduino_cli_commands_v1_settings_proto_rawDescGZIP(), []int{0, 0, 0} } -func (x *SettingsDeleteRequest) GetKey() string { - if x != nil { - return x.Key +func (x *Configuration_Directories_Builtin) GetTools() string { + if x != nil && x.Tools != nil { + return *x.Tools + } + return "" +} + +func (x *Configuration_Directories_Builtin) GetLibraries() string { + if x != nil && x.Libraries != nil { + return *x.Libraries } return "" } -type SettingsDeleteResponse struct { +type SettingsEnumerateResponse_Entry struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + // The key + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // The key type + Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` } -func (x *SettingsDeleteResponse) Reset() { - *x = SettingsDeleteResponse{} +func (x *SettingsEnumerateResponse_Entry) Reset() { + *x = SettingsEnumerateResponse_Entry{} if protoimpl.UnsafeEnabled { - mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[11] + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *SettingsDeleteResponse) String() string { +func (x *SettingsEnumerateResponse_Entry) String() string { return protoimpl.X.MessageStringOf(x) } -func (*SettingsDeleteResponse) ProtoMessage() {} +func (*SettingsEnumerateResponse_Entry) ProtoMessage() {} -func (x *SettingsDeleteResponse) ProtoReflect() protoreflect.Message { - mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[11] +func (x *SettingsEnumerateResponse_Entry) ProtoReflect() protoreflect.Message { + mi := &file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[24] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -574,9 +1354,23 @@ func (x *SettingsDeleteResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use SettingsDeleteResponse.ProtoReflect.Descriptor instead. -func (*SettingsDeleteResponse) Descriptor() ([]byte, []int) { - return file_cc_arduino_cli_commands_v1_settings_proto_rawDescGZIP(), []int{11} +// Deprecated: Use SettingsEnumerateResponse_Entry.ProtoReflect.Descriptor instead. +func (*SettingsEnumerateResponse_Entry) Descriptor() ([]byte, []int) { + return file_cc_arduino_cli_commands_v1_settings_proto_rawDescGZIP(), []int{12, 0} +} + +func (x *SettingsEnumerateResponse_Entry) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *SettingsEnumerateResponse_Entry) GetType() string { + if x != nil { + return x.Type + } + return "" } var File_cc_arduino_cli_commands_v1_settings_proto protoreflect.FileDescriptor @@ -586,45 +1380,187 @@ var file_cc_arduino_cli_commands_v1_settings_proto_rawDesc = []byte{ 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1a, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, - 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x22, 0x35, 0x0a, 0x16, 0x53, 0x65, 0x74, 0x74, 0x69, - 0x6e, 0x67, 0x73, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6a, 0x73, 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x22, 0x33, - 0x0a, 0x14, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x4d, 0x65, 0x72, 0x67, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x64, - 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6a, 0x73, 0x6f, 0x6e, 0x44, - 0x61, 0x74, 0x61, 0x22, 0x49, 0x0a, 0x18, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x47, - 0x65, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x22, 0xe2, 0x0f, 0x0a, 0x0d, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x57, 0x0a, 0x0b, 0x64, 0x69, 0x72, + 0x65, 0x63, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, + 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, + 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, + 0x6f, 0x72, 0x69, 0x65, 0x73, 0x52, 0x0b, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x69, + 0x65, 0x73, 0x12, 0x4b, 0x0a, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, + 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, + 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4e, + 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x52, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x12, + 0x48, 0x0a, 0x06, 0x73, 0x6b, 0x65, 0x74, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x30, 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, + 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x6b, 0x65, 0x74, 0x63, + 0x68, 0x52, 0x06, 0x73, 0x6b, 0x65, 0x74, 0x63, 0x68, 0x12, 0x55, 0x0a, 0x0b, 0x62, 0x75, 0x69, + 0x6c, 0x64, 0x5f, 0x63, 0x61, 0x63, 0x68, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x34, + 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, + 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x43, + 0x61, 0x63, 0x68, 0x65, 0x52, 0x0a, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x43, 0x61, 0x63, 0x68, 0x65, + 0x12, 0x5b, 0x0a, 0x0d, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, + 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, + 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x2e, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x52, + 0x0c, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x12, 0x48, 0x0a, + 0x06, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, + 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, + 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x44, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x52, + 0x06, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x12, 0x48, 0x0a, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, + 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, + 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, + 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x2e, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x52, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, + 0x74, 0x12, 0x4b, 0x0a, 0x07, 0x6c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x18, 0x08, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, + 0x63, 0x6c, 0x69, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, + 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4c, 0x6f, + 0x67, 0x67, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x6c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x12, 0x4b, + 0x0a, 0x07, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x31, 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, + 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4c, 0x69, 0x62, 0x72, 0x61, + 0x72, 0x79, 0x52, 0x07, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x12, 0x4b, 0x0a, 0x07, 0x75, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x72, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x63, + 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, 0x6f, + 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x72, 0x52, + 0x07, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x72, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x6f, 0x63, 0x61, + 0x6c, 0x65, 0x18, 0x64, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x06, 0x6c, 0x6f, 0x63, 0x61, + 0x6c, 0x65, 0x88, 0x01, 0x01, 0x1a, 0xcd, 0x02, 0x0a, 0x0b, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, + 0x6f, 0x72, 0x69, 0x65, 0x73, 0x12, 0x17, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x88, 0x01, 0x01, 0x12, 0x17, + 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x04, + 0x75, 0x73, 0x65, 0x72, 0x88, 0x01, 0x01, 0x12, 0x21, 0x0a, 0x09, 0x64, 0x6f, 0x77, 0x6e, 0x6c, + 0x6f, 0x61, 0x64, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x02, 0x52, 0x09, 0x64, 0x6f, + 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x73, 0x88, 0x01, 0x01, 0x12, 0x5c, 0x0a, 0x07, 0x62, 0x75, + 0x69, 0x6c, 0x74, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3d, 0x2e, 0x63, 0x63, + 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, 0x6f, 0x6d, + 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, + 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x69, + 0x65, 0x73, 0x2e, 0x42, 0x75, 0x69, 0x6c, 0x74, 0x69, 0x6e, 0x48, 0x03, 0x52, 0x07, 0x62, 0x75, + 0x69, 0x6c, 0x74, 0x69, 0x6e, 0x88, 0x01, 0x01, 0x1a, 0x5f, 0x0a, 0x07, 0x42, 0x75, 0x69, 0x6c, + 0x74, 0x69, 0x6e, 0x12, 0x19, 0x0a, 0x05, 0x74, 0x6f, 0x6f, 0x6c, 0x73, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x74, 0x6f, 0x6f, 0x6c, 0x73, 0x88, 0x01, 0x01, 0x12, 0x21, + 0x0a, 0x09, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x48, 0x01, 0x52, 0x09, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x88, 0x01, + 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x74, 0x6f, 0x6f, 0x6c, 0x73, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, + 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x64, 0x61, + 0x74, 0x61, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, + 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x73, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x62, 0x75, + 0x69, 0x6c, 0x74, 0x69, 0x6e, 0x1a, 0x72, 0x0a, 0x07, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, + 0x12, 0x2d, 0x0a, 0x10, 0x65, 0x78, 0x74, 0x72, 0x61, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x61, + 0x67, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0e, 0x65, 0x78, + 0x74, 0x72, 0x61, 0x55, 0x73, 0x65, 0x72, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x12, + 0x19, 0x0a, 0x05, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, + 0x52, 0x05, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x88, 0x01, 0x01, 0x42, 0x13, 0x0a, 0x11, 0x5f, 0x65, + 0x78, 0x74, 0x72, 0x61, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x1a, 0x5e, 0x0a, 0x06, 0x53, 0x6b, 0x65, + 0x74, 0x63, 0x68, 0x12, 0x39, 0x0a, 0x16, 0x61, 0x6c, 0x77, 0x61, 0x79, 0x73, 0x5f, 0x65, 0x78, + 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x14, 0x61, 0x6c, 0x77, 0x61, 0x79, 0x73, 0x45, 0x78, 0x70, + 0x6f, 0x72, 0x74, 0x42, 0x69, 0x6e, 0x61, 0x72, 0x69, 0x65, 0x73, 0x88, 0x01, 0x01, 0x42, 0x19, + 0x0a, 0x17, 0x5f, 0x61, 0x6c, 0x77, 0x61, 0x79, 0x73, 0x5f, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, + 0x5f, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x69, 0x65, 0x73, 0x1a, 0x98, 0x01, 0x0a, 0x0a, 0x42, 0x75, + 0x69, 0x6c, 0x64, 0x43, 0x61, 0x63, 0x68, 0x65, 0x12, 0x3f, 0x0a, 0x19, 0x63, 0x6f, 0x6d, 0x70, + 0x69, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x5f, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x5f, + 0x70, 0x75, 0x72, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x17, 0x63, + 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x65, 0x66, 0x6f, 0x72, + 0x65, 0x50, 0x75, 0x72, 0x67, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1e, 0x0a, 0x08, 0x74, 0x74, 0x6c, + 0x5f, 0x73, 0x65, 0x63, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x48, 0x01, 0x52, 0x07, 0x74, + 0x74, 0x6c, 0x53, 0x65, 0x63, 0x73, 0x88, 0x01, 0x01, 0x42, 0x1c, 0x0a, 0x1a, 0x5f, 0x63, 0x6f, + 0x6d, 0x70, 0x69, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x5f, 0x62, 0x65, 0x66, 0x6f, 0x72, + 0x65, 0x5f, 0x70, 0x75, 0x72, 0x67, 0x65, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x74, 0x74, 0x6c, 0x5f, + 0x73, 0x65, 0x63, 0x73, 0x1a, 0x37, 0x0a, 0x0c, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x4d, 0x61, 0x6e, + 0x61, 0x67, 0x65, 0x72, 0x12, 0x27, 0x0a, 0x0f, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, + 0x61, 0x6c, 0x5f, 0x75, 0x72, 0x6c, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x61, + 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x55, 0x72, 0x6c, 0x73, 0x1a, 0x2a, 0x0a, + 0x06, 0x44, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x12, 0x17, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x88, 0x01, 0x01, + 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x1a, 0x35, 0x0a, 0x06, 0x4f, 0x75, 0x74, + 0x70, 0x75, 0x74, 0x12, 0x1e, 0x0a, 0x08, 0x6e, 0x6f, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x07, 0x6e, 0x6f, 0x43, 0x6f, 0x6c, 0x6f, 0x72, + 0x88, 0x01, 0x01, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x6e, 0x6f, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, + 0x1a, 0x78, 0x0a, 0x07, 0x4c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x12, 0x19, 0x0a, 0x05, 0x6c, + 0x65, 0x76, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x6c, 0x65, + 0x76, 0x65, 0x6c, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, + 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x48, 0x02, 0x52, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, + 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, + 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x1a, 0x5c, 0x0a, 0x07, 0x4c, 0x69, + 0x62, 0x72, 0x61, 0x72, 0x79, 0x12, 0x37, 0x0a, 0x15, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, + 0x75, 0x6e, 0x73, 0x61, 0x66, 0x65, 0x5f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x13, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x55, 0x6e, + 0x73, 0x61, 0x66, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x88, 0x01, 0x01, 0x42, 0x18, + 0x0a, 0x16, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x75, 0x6e, 0x73, 0x61, 0x66, 0x65, + 0x5f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x1a, 0x57, 0x0a, 0x07, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x72, 0x12, 0x34, 0x0a, 0x13, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x6e, 0x6f, + 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, + 0x48, 0x00, 0x52, 0x12, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x42, 0x16, 0x0a, 0x14, 0x5f, 0x65, 0x6e, + 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x22, 0x19, 0x0a, 0x17, + 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x47, 0x65, 0x74, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x6b, 0x0a, 0x18, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x4f, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x63, 0x63, 0x2e, + 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, + 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x32, 0x0a, 0x18, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x61, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x16, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x06, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x22, 0x46, 0x0a, 0x19, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x61, 0x76, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, + 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0f, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, + 0x22, 0x5d, 0x0a, 0x18, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x4f, 0x70, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, + 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x6f, + 0x72, 0x6d, 0x61, 0x74, 0x12, 0x29, 0x0a, 0x10, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x5f, + 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, + 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x22, + 0x1b, 0x0a, 0x19, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x4f, 0x70, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2b, 0x0a, 0x17, + 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x47, 0x65, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, 0x39, 0x0a, 0x18, 0x53, 0x65, 0x74, + 0x74, 0x69, 0x6e, 0x67, 0x73, 0x47, 0x65, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x6a, + 0x73, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x4a, 0x73, 0x6f, 0x6e, 0x22, 0x4a, 0x0a, 0x17, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, + 0x53, 0x65, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, - 0x79, 0x12, 0x1b, 0x0a, 0x09, 0x6a, 0x73, 0x6f, 0x6e, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6a, 0x73, 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x22, 0x48, - 0x0a, 0x17, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x53, 0x65, 0x74, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x1b, 0x0a, 0x09, 0x6a, - 0x73, 0x6f, 0x6e, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x6a, 0x73, 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x22, 0x17, 0x0a, 0x15, 0x53, 0x65, 0x74, 0x74, - 0x69, 0x6e, 0x67, 0x73, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x22, 0x2b, 0x0a, 0x17, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x47, 0x65, 0x74, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, - 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, 0x17, - 0x0a, 0x15, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x4d, 0x65, 0x72, 0x67, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1a, 0x0a, 0x18, 0x53, 0x65, 0x74, 0x74, 0x69, - 0x6e, 0x67, 0x73, 0x53, 0x65, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x33, 0x0a, 0x14, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x57, - 0x72, 0x69, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x66, - 0x69, 0x6c, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x66, 0x69, 0x6c, 0x65, 0x50, 0x61, 0x74, 0x68, 0x22, 0x17, 0x0a, 0x15, 0x53, 0x65, 0x74, 0x74, - 0x69, 0x6e, 0x67, 0x73, 0x57, 0x72, 0x69, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x29, 0x0a, 0x15, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x44, 0x65, 0x6c, - 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, 0x18, 0x0a, 0x16, - 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x48, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x72, 0x64, - 0x75, 0x69, 0x6e, 0x6f, 0x2d, 0x63, 0x6c, 0x69, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x63, 0x63, 0x2f, - 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2f, 0x63, 0x6c, 0x69, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, - 0x61, 0x6e, 0x64, 0x73, 0x2f, 0x76, 0x31, 0x3b, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x79, 0x12, 0x1d, 0x0a, 0x0a, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x4a, 0x73, 0x6f, 0x6e, + 0x22, 0x1a, 0x0a, 0x18, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x53, 0x65, 0x74, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1a, 0x0a, 0x18, + 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x45, 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x61, 0x74, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xa1, 0x01, 0x0a, 0x19, 0x53, 0x65, 0x74, + 0x74, 0x69, 0x6e, 0x67, 0x73, 0x45, 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3b, 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, + 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, + 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x45, 0x6e, 0x75, + 0x6d, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x1a, 0x2d, 0x0a, + 0x05, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x42, 0x48, 0x5a, 0x46, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x72, 0x64, 0x75, 0x69, + 0x6e, 0x6f, 0x2f, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2d, 0x63, 0x6c, 0x69, 0x2f, 0x72, + 0x70, 0x63, 0x2f, 0x63, 0x63, 0x2f, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2f, 0x63, 0x6c, + 0x69, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2f, 0x76, 0x31, 0x3b, 0x63, 0x6f, + 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -639,27 +1575,53 @@ func file_cc_arduino_cli_commands_v1_settings_proto_rawDescGZIP() []byte { return file_cc_arduino_cli_commands_v1_settings_proto_rawDescData } -var file_cc_arduino_cli_commands_v1_settings_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_cc_arduino_cli_commands_v1_settings_proto_msgTypes = make([]protoimpl.MessageInfo, 25) var file_cc_arduino_cli_commands_v1_settings_proto_goTypes = []interface{}{ - (*SettingsGetAllResponse)(nil), // 0: cc.arduino.cli.commands.v1.SettingsGetAllResponse - (*SettingsMergeRequest)(nil), // 1: cc.arduino.cli.commands.v1.SettingsMergeRequest - (*SettingsGetValueResponse)(nil), // 2: cc.arduino.cli.commands.v1.SettingsGetValueResponse - (*SettingsSetValueRequest)(nil), // 3: cc.arduino.cli.commands.v1.SettingsSetValueRequest - (*SettingsGetAllRequest)(nil), // 4: cc.arduino.cli.commands.v1.SettingsGetAllRequest - (*SettingsGetValueRequest)(nil), // 5: cc.arduino.cli.commands.v1.SettingsGetValueRequest - (*SettingsMergeResponse)(nil), // 6: cc.arduino.cli.commands.v1.SettingsMergeResponse - (*SettingsSetValueResponse)(nil), // 7: cc.arduino.cli.commands.v1.SettingsSetValueResponse - (*SettingsWriteRequest)(nil), // 8: cc.arduino.cli.commands.v1.SettingsWriteRequest - (*SettingsWriteResponse)(nil), // 9: cc.arduino.cli.commands.v1.SettingsWriteResponse - (*SettingsDeleteRequest)(nil), // 10: cc.arduino.cli.commands.v1.SettingsDeleteRequest - (*SettingsDeleteResponse)(nil), // 11: cc.arduino.cli.commands.v1.SettingsDeleteResponse + (*Configuration)(nil), // 0: cc.arduino.cli.commands.v1.Configuration + (*ConfigurationGetRequest)(nil), // 1: cc.arduino.cli.commands.v1.ConfigurationGetRequest + (*ConfigurationGetResponse)(nil), // 2: cc.arduino.cli.commands.v1.ConfigurationGetResponse + (*ConfigurationSaveRequest)(nil), // 3: cc.arduino.cli.commands.v1.ConfigurationSaveRequest + (*ConfigurationSaveResponse)(nil), // 4: cc.arduino.cli.commands.v1.ConfigurationSaveResponse + (*ConfigurationOpenRequest)(nil), // 5: cc.arduino.cli.commands.v1.ConfigurationOpenRequest + (*ConfigurationOpenResponse)(nil), // 6: cc.arduino.cli.commands.v1.ConfigurationOpenResponse + (*SettingsGetValueRequest)(nil), // 7: cc.arduino.cli.commands.v1.SettingsGetValueRequest + (*SettingsGetValueResponse)(nil), // 8: cc.arduino.cli.commands.v1.SettingsGetValueResponse + (*SettingsSetValueRequest)(nil), // 9: cc.arduino.cli.commands.v1.SettingsSetValueRequest + (*SettingsSetValueResponse)(nil), // 10: cc.arduino.cli.commands.v1.SettingsSetValueResponse + (*SettingsEnumerateRequest)(nil), // 11: cc.arduino.cli.commands.v1.SettingsEnumerateRequest + (*SettingsEnumerateResponse)(nil), // 12: cc.arduino.cli.commands.v1.SettingsEnumerateResponse + (*Configuration_Directories)(nil), // 13: cc.arduino.cli.commands.v1.Configuration.Directories + (*Configuration_Network)(nil), // 14: cc.arduino.cli.commands.v1.Configuration.Network + (*Configuration_Sketch)(nil), // 15: cc.arduino.cli.commands.v1.Configuration.Sketch + (*Configuration_BuildCache)(nil), // 16: cc.arduino.cli.commands.v1.Configuration.BuildCache + (*Configuration_BoardManager)(nil), // 17: cc.arduino.cli.commands.v1.Configuration.BoardManager + (*Configuration_Daemon)(nil), // 18: cc.arduino.cli.commands.v1.Configuration.Daemon + (*Configuration_Output)(nil), // 19: cc.arduino.cli.commands.v1.Configuration.Output + (*Configuration_Logging)(nil), // 20: cc.arduino.cli.commands.v1.Configuration.Logging + (*Configuration_Library)(nil), // 21: cc.arduino.cli.commands.v1.Configuration.Library + (*Configuration_Updater)(nil), // 22: cc.arduino.cli.commands.v1.Configuration.Updater + (*Configuration_Directories_Builtin)(nil), // 23: cc.arduino.cli.commands.v1.Configuration.Directories.Builtin + (*SettingsEnumerateResponse_Entry)(nil), // 24: cc.arduino.cli.commands.v1.SettingsEnumerateResponse.Entry } var file_cc_arduino_cli_commands_v1_settings_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 13, // 0: cc.arduino.cli.commands.v1.Configuration.directories:type_name -> cc.arduino.cli.commands.v1.Configuration.Directories + 14, // 1: cc.arduino.cli.commands.v1.Configuration.network:type_name -> cc.arduino.cli.commands.v1.Configuration.Network + 15, // 2: cc.arduino.cli.commands.v1.Configuration.sketch:type_name -> cc.arduino.cli.commands.v1.Configuration.Sketch + 16, // 3: cc.arduino.cli.commands.v1.Configuration.build_cache:type_name -> cc.arduino.cli.commands.v1.Configuration.BuildCache + 17, // 4: cc.arduino.cli.commands.v1.Configuration.board_manager:type_name -> cc.arduino.cli.commands.v1.Configuration.BoardManager + 18, // 5: cc.arduino.cli.commands.v1.Configuration.daemon:type_name -> cc.arduino.cli.commands.v1.Configuration.Daemon + 19, // 6: cc.arduino.cli.commands.v1.Configuration.output:type_name -> cc.arduino.cli.commands.v1.Configuration.Output + 20, // 7: cc.arduino.cli.commands.v1.Configuration.logging:type_name -> cc.arduino.cli.commands.v1.Configuration.Logging + 21, // 8: cc.arduino.cli.commands.v1.Configuration.library:type_name -> cc.arduino.cli.commands.v1.Configuration.Library + 22, // 9: cc.arduino.cli.commands.v1.Configuration.updater:type_name -> cc.arduino.cli.commands.v1.Configuration.Updater + 0, // 10: cc.arduino.cli.commands.v1.ConfigurationGetResponse.configuration:type_name -> cc.arduino.cli.commands.v1.Configuration + 24, // 11: cc.arduino.cli.commands.v1.SettingsEnumerateResponse.entries:type_name -> cc.arduino.cli.commands.v1.SettingsEnumerateResponse.Entry + 23, // 12: cc.arduino.cli.commands.v1.Configuration.Directories.builtin:type_name -> cc.arduino.cli.commands.v1.Configuration.Directories.Builtin + 13, // [13:13] is the sub-list for method output_type + 13, // [13:13] is the sub-list for method input_type + 13, // [13:13] is the sub-list for extension type_name + 13, // [13:13] is the sub-list for extension extendee + 0, // [0:13] is the sub-list for field type_name } func init() { file_cc_arduino_cli_commands_v1_settings_proto_init() } @@ -669,7 +1631,7 @@ func file_cc_arduino_cli_commands_v1_settings_proto_init() { } if !protoimpl.UnsafeEnabled { file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SettingsGetAllResponse); i { + switch v := v.(*Configuration); i { case 0: return &v.state case 1: @@ -681,7 +1643,7 @@ func file_cc_arduino_cli_commands_v1_settings_proto_init() { } } file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SettingsMergeRequest); i { + switch v := v.(*ConfigurationGetRequest); i { case 0: return &v.state case 1: @@ -693,7 +1655,7 @@ func file_cc_arduino_cli_commands_v1_settings_proto_init() { } } file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SettingsGetValueResponse); i { + switch v := v.(*ConfigurationGetResponse); i { case 0: return &v.state case 1: @@ -705,7 +1667,7 @@ func file_cc_arduino_cli_commands_v1_settings_proto_init() { } } file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SettingsSetValueRequest); i { + switch v := v.(*ConfigurationSaveRequest); i { case 0: return &v.state case 1: @@ -717,7 +1679,7 @@ func file_cc_arduino_cli_commands_v1_settings_proto_init() { } } file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SettingsGetAllRequest); i { + switch v := v.(*ConfigurationSaveResponse); i { case 0: return &v.state case 1: @@ -729,7 +1691,7 @@ func file_cc_arduino_cli_commands_v1_settings_proto_init() { } } file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SettingsGetValueRequest); i { + switch v := v.(*ConfigurationOpenRequest); i { case 0: return &v.state case 1: @@ -741,7 +1703,7 @@ func file_cc_arduino_cli_commands_v1_settings_proto_init() { } } file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SettingsMergeResponse); i { + switch v := v.(*ConfigurationOpenResponse); i { case 0: return &v.state case 1: @@ -753,7 +1715,7 @@ func file_cc_arduino_cli_commands_v1_settings_proto_init() { } } file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SettingsSetValueResponse); i { + switch v := v.(*SettingsGetValueRequest); i { case 0: return &v.state case 1: @@ -765,7 +1727,7 @@ func file_cc_arduino_cli_commands_v1_settings_proto_init() { } } file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SettingsWriteRequest); i { + switch v := v.(*SettingsGetValueResponse); i { case 0: return &v.state case 1: @@ -777,7 +1739,7 @@ func file_cc_arduino_cli_commands_v1_settings_proto_init() { } } file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SettingsWriteResponse); i { + switch v := v.(*SettingsSetValueRequest); i { case 0: return &v.state case 1: @@ -789,7 +1751,7 @@ func file_cc_arduino_cli_commands_v1_settings_proto_init() { } } file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SettingsDeleteRequest); i { + switch v := v.(*SettingsSetValueResponse); i { case 0: return &v.state case 1: @@ -801,7 +1763,163 @@ func file_cc_arduino_cli_commands_v1_settings_proto_init() { } } file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SettingsDeleteResponse); i { + switch v := v.(*SettingsEnumerateRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SettingsEnumerateResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Configuration_Directories); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Configuration_Network); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Configuration_Sketch); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Configuration_BuildCache); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Configuration_BoardManager); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Configuration_Daemon); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Configuration_Output); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Configuration_Logging); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Configuration_Library); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Configuration_Updater); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Configuration_Directories_Builtin); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SettingsEnumerateResponse_Entry); i { case 0: return &v.state case 1: @@ -813,13 +1931,24 @@ func file_cc_arduino_cli_commands_v1_settings_proto_init() { } } } + file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[0].OneofWrappers = []interface{}{} + file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[13].OneofWrappers = []interface{}{} + file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[14].OneofWrappers = []interface{}{} + file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[15].OneofWrappers = []interface{}{} + file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[16].OneofWrappers = []interface{}{} + file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[18].OneofWrappers = []interface{}{} + file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[19].OneofWrappers = []interface{}{} + file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[20].OneofWrappers = []interface{}{} + file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[21].OneofWrappers = []interface{}{} + file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[22].OneofWrappers = []interface{}{} + file_cc_arduino_cli_commands_v1_settings_proto_msgTypes[23].OneofWrappers = []interface{}{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_cc_arduino_cli_commands_v1_settings_proto_rawDesc, NumEnums: 0, - NumMessages: 12, + NumMessages: 25, NumExtensions: 0, NumServices: 0, }, diff --git a/rpc/cc/arduino/cli/commands/v1/settings.proto b/rpc/cc/arduino/cli/commands/v1/settings.proto index 05a6ea16a22..9e6b0372938 100644 --- a/rpc/cc/arduino/cli/commands/v1/settings.proto +++ b/rpc/cc/arduino/cli/commands/v1/settings.proto @@ -19,51 +19,133 @@ package cc.arduino.cli.commands.v1; option go_package = "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1;commands"; -message SettingsGetAllResponse { - // The settings, in JSON format. - string json_data = 1; -} +// Configuration to apply to the given instance. +// Any missing field will be kept at the default value. +message Configuration { + message Directories { + message Builtin { + // The directory where the built-in tools are installed + optional string tools = 1; + // The directory where the built-in libraries are installed + optional string libraries = 2; + } + // Data directory + optional string data = 1; + // User directory + optional string user = 2; + // Downloads directory + optional string downloads = 3; + // The directory where the built-in resources are installed + optional Builtin builtin = 4; + }; + message Network { + // Extra user-agent information to be appended in network requests + optional string extra_user_agent = 1; + // The proxy to use for network requests + optional string proxy = 2; + }; + message Sketch { + // Set to true to always export binaries to the sketch directory + optional bool always_export_binaries = 1; + } + message BuildCache { + // The minimum number of compilations before the cache is purged + optional uint32 compilations_before_purge = 1; + // Time to live of the cache in seconds + optional uint64 ttl_secs = 2; + } + message BoardManager { + // Additional URLs to be used for the board manager + repeated string additional_urls = 1; + } + message Daemon { + // The TCP port of the daemon + optional string port = 1; + } + message Output { + // Set to true to disable coloring of the output + optional bool no_color = 1; + } + message Logging { + // The logging level + optional string level = 1; + // The logging format + optional string format = 2; + // The logging file + optional string file = 3; + } + message Library { + // Set to true to enable library installation from zip archives or git + // repositories + optional bool enable_unsafe_install = 1; + } + message Updater { + // Set to true to enable notifications for updates + optional bool enable_notification = 1; + } + + Directories directories = 1; + Network network = 2; + Sketch sketch = 3; + BuildCache build_cache = 4; + BoardManager board_manager = 5; + Daemon daemon = 6; + Output output = 7; + Logging logging = 8; + Library library = 9; + Updater updater = 10; -message SettingsMergeRequest { - // The settings, in JSON format. - string json_data = 1; + optional string locale = 100; } -message SettingsGetValueResponse { - // The key of the setting. - string key = 1; - // The setting, in JSON format. - string json_data = 2; +message ConfigurationGetRequest {} + +message ConfigurationGetResponse { + // The current configuration + Configuration configuration = 1; } -message SettingsSetValueRequest { - // The key of the setting. - string key = 1; - // The setting, in JSON format. - string json_data = 2; +message ConfigurationSaveRequest { string format = 1; } + +message ConfigurationSaveResponse { string encoded_settings = 1; } + +message ConfigurationOpenRequest { + string format = 1; + string encoded_settings = 2; } -message SettingsGetAllRequest {} +message ConfigurationOpenResponse {} message SettingsGetValueRequest { - // The key of the setting. + // The key to get string key = 1; } -message SettingsMergeResponse {} +message SettingsGetValueResponse { + // The value of the key as a JSON string (no objects, only scalar or array of + // scalars are allowed) + string value_json = 1; +} + +message SettingsSetValueRequest { + // The key to change + string key = 1; + // The new value (no objects, only scalar or array of scalars are allowed) + string value_json = 2; +} message SettingsSetValueResponse {} -message SettingsWriteRequest { - // Path to settings file (e.g. /path/to/arduino-cli.yaml) - string file_path = 1; -} +message SettingsEnumerateRequest {} -message SettingsWriteResponse {} +message SettingsEnumerateResponse { + message Entry { + // The key + string key = 1; + // The key type + string type = 2; + } -message SettingsDeleteRequest { - // The key of the setting to delete. - string key = 1; + // The list of key/value pairs + repeated Entry entries = 1; } - -message SettingsDeleteResponse {} diff --git a/rpc/internal/client_example/main.go b/rpc/internal/client_example/main.go index dd23b0ec8d5..eabf6bfd2d9 100644 --- a/rpc/internal/client_example/main.go +++ b/rpc/internal/client_example/main.go @@ -23,7 +23,6 @@ import ( "io" "log" "os" - "path" "path/filepath" "strings" "time" @@ -245,84 +244,84 @@ func callVersion(client rpc.ArduinoCoreServiceClient) { } func callSetValue(client rpc.ArduinoCoreServiceClient) { - _, err := client.SettingsSetValue(context.Background(), - &rpc.SettingsSetValueRequest{ - Key: "directories", - JsonData: `{"data": "` + dataDir + `", "downloads": "` + path.Join(dataDir, "staging") + `", "user": "` + path.Join(dataDir, "sketchbook") + `"}`, - }) + // _, err := client.SettingsSetValue(context.Background(), + // &rpc.SettingsSetValueRequest{ + // Key: "directories", + // JsonData: `{"data": "` + dataDir + `", "downloads": "` + path.Join(dataDir, "staging") + `", "user": "` + path.Join(dataDir, "sketchbook") + `"}`, + // }) - if err != nil { - log.Fatalf("Error setting settings value: %s", err) - } + // if err != nil { + // log.Fatalf("Error setting settings value: %s", err) + // } } func callSetProxy(client rpc.ArduinoCoreServiceClient) { - _, err := client.SettingsSetValue(context.Background(), - &rpc.SettingsSetValueRequest{ - Key: "network.proxy", - JsonData: `"http://localhost:3128"`, - }) + // _, err := client.SettingsSetValue(context.Background(), + // &rpc.SettingsSetValueRequest{ + // Key: "network.proxy", + // JsonData: `"http://localhost:3128"`, + // }) - if err != nil { - log.Fatalf("Error setting settings value: %s", err) - } + // if err != nil { + // log.Fatalf("Error setting settings value: %s", err) + // } } func callUnsetProxy(client rpc.ArduinoCoreServiceClient) { - _, err := client.SettingsSetValue(context.Background(), - &rpc.SettingsSetValueRequest{ - Key: "network.proxy", - JsonData: `""`, - }) + // _, err := client.SettingsSetValue(context.Background(), + // &rpc.SettingsSetValueRequest{ + // Key: "network.proxy", + // JsonData: `""`, + // }) - if err != nil { - log.Fatalf("Error setting settings value: %s", err) - } + // if err != nil { + // log.Fatalf("Error setting settings value: %s", err) + // } } func callMerge(client rpc.ArduinoCoreServiceClient, jsonData string) { - _, err := client.SettingsMerge(context.Background(), - &rpc.SettingsMergeRequest{ - JsonData: jsonData, - }) + // _, err := client.SettingsMerge(context.Background(), + // &rpc.SettingsMergeRequest{ + // JsonData: jsonData, + // }) - if err != nil { - log.Fatalf("Error merging settings: %s", err) - } + // if err != nil { + // log.Fatalf("Error merging settings: %s", err) + // } } func callGetValue(client rpc.ArduinoCoreServiceClient) { - getValueResp, err := client.SettingsGetValue(context.Background(), - &rpc.SettingsGetValueRequest{ - Key: "foo", - }) + // getValueResp, err := client.SettingsGetValue(context.Background(), + // &rpc.SettingsGetValueRequest{ + // Key: "foo", + // }) - if err != nil { - log.Fatalf("Error getting settings value: %s", err) - } + // if err != nil { + // log.Fatalf("Error getting settings value: %s", err) + // } - log.Printf("Value: %s: %s", getValueResp.GetKey(), getValueResp.GetJsonData()) + // log.Printf("Value: %s: %s", getValueResp.GetKey(), getValueResp.GetJsonData()) } func callGetAll(client rpc.ArduinoCoreServiceClient) { - getAllResp, err := client.SettingsGetAll(context.Background(), &rpc.SettingsGetAllRequest{}) + // getAllResp, err := client.SettingsGetAll(context.Background(), &rpc.SettingsGetAllRequest{}) - if err != nil { - log.Fatalf("Error getting settings: %s", err) - } + // if err != nil { + // log.Fatalf("Error getting settings: %s", err) + // } - log.Printf("Settings: %s", getAllResp.GetJsonData()) + // log.Printf("Settings: %s", getAllResp.GetJsonData()) } func callWrite(client rpc.ArduinoCoreServiceClient) { - _, err := client.SettingsWrite(context.Background(), - &rpc.SettingsWriteRequest{ - FilePath: path.Join(dataDir, "written-rpc.Settingsyml"), - }) + // _, err := client.SettingsWrite(context.Background(), + // &rpc.SettingsWriteRequest{ + // FilePath: path.Join(dataDir, "written-rpc.Settingsyml"), + // }) - if err != nil { - log.Fatalf("Error writing settings: %s", err) - } + // if err != nil { + // log.Fatalf("Error writing settings: %s", err) + // } } func createInstance(client rpc.ArduinoCoreServiceClient) *rpc.Instance {