File tree 1 file changed +6
-8
lines changed
1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ import (
19
19
"context"
20
20
21
21
"github.com/arduino/arduino-cli/commands/sketch"
22
+ f "github.com/arduino/arduino-cli/internal/algorithms"
22
23
"github.com/arduino/arduino-cli/internal/cli/feedback"
23
24
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
24
25
"github.com/arduino/go-paths-helper"
@@ -57,13 +58,10 @@ func GetSketchProfiles(sketchPath string) []string {
57
58
return nil
58
59
}
59
60
}
60
- list , _ := sketch .LoadSketch (context .Background (), & rpc.LoadSketchRequest {
61
- SketchPath : sketchPath ,
62
- })
63
- profiles := list .GetProfiles ()
64
- res := make ([]string , len (profiles ))
65
- for i , p := range list .GetProfiles () {
66
- res [i ] = p .GetName ()
61
+ sk , err := sketch .LoadSketch (context .Background (), & rpc.LoadSketchRequest {SketchPath : sketchPath })
62
+ if err != nil {
63
+ return nil
67
64
}
68
- return res
65
+ profiles := sk .GetProfiles ()
66
+ return f .Map (profiles , (* rpc .SketchProfile ).GetName )
69
67
}
You can’t perform that action at this time.
0 commit comments