Skip to content

Commit 8f009bc

Browse files
Apply review suggestions
Co-authored-by: Per Tillisch <[email protected]>
1 parent a99efdd commit 8f009bc

File tree

10 files changed

+34
-33
lines changed

10 files changed

+34
-33
lines changed

commands/cmderrors/cmderrors.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ func (e *DuplicateProfileError) Error() string {
222222

223223
// GRPCStatus converts the error into a *status.Status
224224
func (e *DuplicateProfileError) GRPCStatus() *status.Status {
225-
return status.New(codes.NotFound, e.Error())
225+
return status.New(codes.AlreadyExists, e.Error())
226226
}
227227

228228
// InvalidProfileError is returned when the profile has errors

commands/service_profile_dump.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func (s *arduinoCoreServerImpl) ProfileDump(ctx context.Context, req *rpc.Profil
3535
switch req.GetDumpFormat() {
3636
case "yaml":
3737
return &rpc.ProfileDumpResponse{EncodedProfile: sk.Project.AsYaml()}, nil
38-
case "json":
38+
case "", "json":
3939
data, err := json.MarshalIndent(sk.Project, "", " ")
4040
if err != nil {
4141
return nil, fmt.Errorf("error marshalling settings: %v", err)

internal/cli/profile/dump.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ import (
2929
func initDumpCommand(srv rpc.ArduinoCoreServiceServer) *cobra.Command {
3030
dumpCommand := &cobra.Command{
3131
Use: "dump",
32-
Short: i18n.Tr("Dumps the project file."),
33-
Long: i18n.Tr("Dumps the project file."),
32+
Short: i18n.Tr("Print the sketch project file."),
33+
Long: i18n.Tr("Print the data from the sketch project file."),
3434
Example: "" +
3535
" " + os.Args[0] + " profile dump\n",
3636
Args: cobra.MaximumNArgs(1),

internal/cli/profile/init.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ func initInitCommand(srv rpc.ArduinoCoreServiceServer) *cobra.Command {
3131
var defaultProfile bool
3232
initCommand := &cobra.Command{
3333
Use: "init",
34-
Short: i18n.Tr("Creates or updates the sketch project file."),
35-
Long: i18n.Tr("Creates or updates the sketch project file."),
34+
Short: i18n.Tr("Create or update the sketch project file."),
35+
Long: i18n.Tr("Create or update the sketch project file."),
3636
Example: "" +
3737
" # " + i18n.Tr("Creates or updates the sketch project file in the current directory.") + "\n" +
3838
" " + os.Args[0] + " profile init\n" +
39-
" " + os.Args[0] + " config init --profile Uno_profile -b arduino:avr:uno",
39+
" " + os.Args[0] + " profile init --profile uno_profile -b arduino:avr:uno",
4040
Args: cobra.MaximumNArgs(1),
4141
Run: func(cmd *cobra.Command, args []string) {
4242
runInitCommand(cmd.Context(), args, srv, defaultProfile)

internal/cli/profile/lib.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ import (
3232
func initLibCommand(srv rpc.ArduinoCoreServiceServer) *cobra.Command {
3333
libCommand := &cobra.Command{
3434
Use: "lib",
35-
Short: i18n.Tr("Profile commands about libraries."),
36-
Long: i18n.Tr("Profile commands about libraries."),
35+
Short: i18n.Tr("Commands related to build profile libraries."),
36+
Long: i18n.Tr("Commands related to the library dependencies of build profiles."),
3737
Example: "" +
3838
" " + os.Args[0] + " profile lib add AudioZero -m my_profile\n" +
3939
" " + os.Args[0] + " profile lib remove Arduino_JSON --profile my_profile\n",
@@ -64,7 +64,7 @@ func initLibAddCommand(srv rpc.ArduinoCoreServiceServer) *cobra.Command {
6464
},
6565
}
6666

67-
addCommand.Flags().StringVar(&destDir, "dest-dir", "", i18n.Tr("Location of the project file."))
67+
addCommand.Flags().StringVar(&destDir, "dest-dir", "", i18n.Tr("Location of the sketch project file."))
6868
profileArg.AddToCommand(addCommand, srv)
6969

7070
return addCommand
@@ -112,7 +112,7 @@ func initLibRemoveCommand(srv rpc.ArduinoCoreServiceServer) *cobra.Command {
112112
},
113113
}
114114

115-
removeCommand.Flags().StringVar(&destDir, "dest-dir", "", i18n.Tr("Location of the project file."))
115+
removeCommand.Flags().StringVar(&destDir, "dest-dir", "", i18n.Tr("Location of the sketch project file."))
116116
profileArg.AddToCommand(removeCommand, srv)
117117

118118
return removeCommand

internal/cli/profile/profile.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ var (
3232
func NewCommand(srv rpc.ArduinoCoreServiceServer) *cobra.Command {
3333
profileCommand := &cobra.Command{
3434
Use: "profile",
35-
Short: i18n.Tr("Arduino profile operations."),
36-
Long: i18n.Tr("Arduino profile operations."),
35+
Short: i18n.Tr("Build profile operations."),
36+
Long: i18n.Tr("Build profile operations."),
3737
Example: " " + os.Args[0] + " profile init",
3838
}
3939

internal/cli/profile/set_default.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ func initSetDefaultCommand(srv rpc.ArduinoCoreServiceServer) *cobra.Command {
3030
var destDir string
3131
setDefaultCommand := &cobra.Command{
3232
Use: "set-default",
33-
Short: i18n.Tr("Sets the default profile."),
34-
Long: i18n.Tr("Sets the default profile."),
33+
Short: i18n.Tr("Set the default build profile."),
34+
Long: i18n.Tr("Set the default build profile."),
3535
Example: "" +
3636
" " + os.Args[0] + " profile set-default my_profile\n",
3737
Args: cobra.ExactArgs(1),
@@ -40,7 +40,7 @@ func initSetDefaultCommand(srv rpc.ArduinoCoreServiceServer) *cobra.Command {
4040
},
4141
}
4242

43-
setDefaultCommand.Flags().StringVar(&destDir, "dest-dir", "", i18n.Tr("Location of the project file."))
43+
setDefaultCommand.Flags().StringVar(&destDir, "dest-dir", "", i18n.Tr("Location of the sketch project file."))
4444

4545
return setDefaultCommand
4646
}
@@ -53,4 +53,5 @@ func runSetDefaultCommand(ctx context.Context, args []string, srv rpc.ArduinoCor
5353
if err != nil {
5454
feedback.Fatal(i18n.Tr("Cannot set %s as default profile: %v", profileName, err), feedback.ErrGeneric)
5555
}
56+
feedback.Print(i18n.Tr("Default profile set to: %s", profileName))
5657
}

rpc/cc/arduino/cli/commands/v1/commands.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rpc/cc/arduino/cli/commands/v1/commands.proto

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -191,19 +191,19 @@ service ArduinoCoreService {
191191
// Set a single configuration value.
192192
rpc SettingsSetValue(SettingsSetValueRequest) returns (SettingsSetValueResponse);
193193

194-
// Create the project file and add a profile to it.
194+
// Create the sketch project file and add a build profile to it.
195195
rpc InitProfile(InitProfileRequest) returns (InitProfileResponse) {}
196196

197-
// Add a library to the profile.
197+
// Add a library to the build profile.
198198
rpc ProfileLibAdd(ProfileLibAddRequest) returns (ProfileLibAddResponse) {}
199199

200-
// Remove a library from the profile.
200+
// Remove a library from the build profile.
201201
rpc ProfileLibRemove(ProfileLibRemoveRequest) returns (ProfileLibRemoveResponse) {}
202202

203-
// Set the default profile.
203+
// Set the default build profile.
204204
rpc ProfileSetDefault(ProfileSetDefaultRequest) returns (ProfileSetDefaultResponse) {}
205205

206-
// Dump the project file.
206+
// Dump the sketch project file.
207207
rpc ProfileDump(ProfileDumpRequest) returns (ProfileDumpResponse) {}
208208
}
209209

@@ -505,7 +505,7 @@ message ProfileSetDefaultResponse {}
505505
message ProfileDumpRequest {
506506
// Absolute path to Sketch folder.
507507
string sketch_path = 1;
508-
// The format of the dump.
508+
// The format of the dump (default is "json", allowed values are "json", and "yaml").
509509
string dump_format = 2;
510510
}
511511

rpc/cc/arduino/cli/commands/v1/commands_grpc.pb.go

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)