File tree 2 files changed +21
-1
lines changed
2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,10 @@ package arguments
18
18
import (
19
19
"fmt"
20
20
"strings"
21
+
22
+ "github.com/arduino/arduino-cli/cli/instance"
23
+ "github.com/arduino/arduino-cli/commands/core"
24
+ rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
21
25
)
22
26
23
27
// Reference represents a reference item (core or library) passed to the CLI
@@ -80,5 +84,20 @@ func ParseReference(arg string) (*Reference, error) {
80
84
}
81
85
ret .Architecture = toks [1 ]
82
86
87
+ // We try to optimize the search and help the user
88
+ platforms , _ := core .GetPlatforms (& rpc.PlatformListRequest {
89
+ Instance : instance .CreateAndInit (),
90
+ UpdatableOnly : false ,
91
+ All : true ,
92
+ })
93
+ for _ , platform := range platforms {
94
+ if strings .EqualFold (platform .GetId (), ret .PackageName + ":" + ret .Architecture ) {
95
+ toks = strings .Split (platform .GetId (), ":" )
96
+ ret .PackageName = toks [0 ]
97
+ ret .Architecture = toks [1 ]
98
+ break // is it ok to stop at the first result?
99
+ }
100
+ }
101
+
83
102
return ret , nil
84
103
}
Original file line number Diff line number Diff line change @@ -12,7 +12,8 @@ always parsed by the function.
12
12
### ` ParseReference() function change in ` arduino-cli` package
13
13
14
14
The ` parseArch ` parameter was removed since it was unused and was always true. This means that the architecture gets
15
- always parsed by the function.
15
+ always parsed by the function. Furthermore the function now should also correctly interpret ` packager:arch ` spelled with
16
+ the wrong casing.
16
17
17
18
## 0.20.0
18
19
You can’t perform that action at this time.
0 commit comments