Skip to content

Commit 9a1a777

Browse files
kittaakosvinay-lanka
authored and
vinay-lanka
committed
arduinoGH-612: core search can match Platform#ID too. (arduino#615)
When matching against a Platform#ID, the match must be a case-insensitive exact match. Closes arduino#612. Signed-off-by: Akos Kitta <[email protected]> update compile --build-path to support both relative and absolute flags
1 parent fbcd87f commit 9a1a777

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

Diff for: cli/compile/compile.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package compile
1818
import (
1919
"context"
2020
"os"
21+
"fmt"
2122

2223
"github.com/arduino/arduino-cli/cli/feedback"
2324

@@ -101,7 +102,11 @@ func run(cmd *cobra.Command, args []string) {
101102
}
102103

103104
sketchPath := initSketchPath(path)
104-
105+
fmt.Println("FLAG LMAO")
106+
fmt.Println(buildPath)
107+
if string(buildPath) != "/" {
108+
buildPath = args[0]
109+
}
105110
_, err = compile.Compile(context.Background(), &rpc.CompileReq{
106111
Instance: inst,
107112
Fqbn: fqbn,

Diff for: commands/core/search.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ func match(line, searchArgs string) bool {
2929
return strings.Contains(strings.ToLower(line), strings.ToLower(searchArgs))
3030
}
3131

32+
func exactMatch(line, searchArgs string) bool {
33+
return strings.Compare(strings.ToLower(line), strings.ToLower(searchArgs)) == 0
34+
}
35+
3236
// PlatformSearch FIXMEDOC
3337
func PlatformSearch(instanceID int32, searchArgs string, allVersions bool) (*rpc.PlatformSearchResp, error) {
3438
pm := commands.GetPackageManager(instanceID)
@@ -55,7 +59,7 @@ func PlatformSearch(instanceID int32, searchArgs string, allVersions bool) (*rpc
5559
}
5660

5761
// platform has a valid release, check if it matches the search arguments
58-
if match(platform.Name, searchArgs) || match(platform.Architecture, searchArgs) {
62+
if match(platform.Name, searchArgs) || match(platform.Architecture, searchArgs) || exactMatch(platform.String(), searchArgs) {
5963
if allVersions {
6064
res = append(res, platform.GetAllReleases()...)
6165
} else {

0 commit comments

Comments
 (0)