Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 8759bf4

Browse files
GH-612: core search can match Platform#ID too. (#615)
When matching against a Platform#ID, the match must be a case-insensitive exact match. Closes #612. Signed-off-by: Akos Kitta <kittaakos@typefox.io>
1 parent fbcd87f commit 8759bf4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

‎commands/core/search.go‎

Lines changed: 5 additions & 1 deletion
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)

AltStyle によって変換されたページ (->オリジナル) /