diff --git a/commands/core/search.go b/commands/core/search.go index 1d9a39c440a..69b81e3b369 100644 --- a/commands/core/search.go +++ b/commands/core/search.go @@ -85,6 +85,9 @@ func PlatformSearch(req *rpc.PlatformSearchRequest) (*rpc.PlatformSearchResponse out := make([]*rpc.Platform, len(res)) for i, platformRelease := range res { out[i] = commands.PlatformReleaseToRPC(platformRelease) + if platformRelease.IsInstalled() { + out[i].Installed = platformRelease.Version.String() + } } // Sort result alphabetically and put deprecated platforms at the bottom sort.Slice( diff --git a/internal/integrationtest/core/core_test.go b/internal/integrationtest/core/core_test.go index b2b68dd366e..d979603a3e0 100644 --- a/internal/integrationtest/core/core_test.go +++ b/internal/integrationtest/core/core_test.go @@ -68,9 +68,13 @@ func TestCoreSearch(t *testing.T) { require.NoError(t, err) require.Greater(t, len(strings.Split(string(out), "\n")), 2) + _, _, err = cli.Run("core", "install", "arduino:avr@1.8.6") + require.NoError(t, err) out, _, err = cli.Run("core", "search", "avr", "--format", "json") require.NoError(t, err) requirejson.NotEmpty(t, out) + // Verify that "installed" is set + requirejson.Contains(t, out, `[{installed: "1.8.6"}]`) // additional URL out, _, err = cli.Run("core", "search", "test_core", "--format", "json", "--additional-urls="+url.String())