diff --git a/internal/cli/core/list.go b/internal/cli/core/list.go index 23b92f1befc..4645295b063 100644 --- a/internal/cli/core/list.go +++ b/internal/cli/core/list.go @@ -82,10 +82,9 @@ func (ir installedResult) Data() interface{} { } func (ir installedResult) String() string { - if ir.platforms == nil || len(ir.platforms) == 0 { - return "" + if len(ir.platforms) == 0 { + return tr("No platforms installed.") } - t := table.New() t.SetHeader(tr("ID"), tr("Installed"), tr("Latest"), tr("Name")) for _, p := range ir.platforms { diff --git a/internal/integrationtest/core/core_test.go b/internal/integrationtest/core/core_test.go index d979603a3e0..4b75dba08fc 100644 --- a/internal/integrationtest/core/core_test.go +++ b/internal/integrationtest/core/core_test.go @@ -1058,3 +1058,16 @@ func TestCoreUpgradeWarningWithPackageInstalledButNotIndexed(t *testing.T) { requirejson.Query(t, jsonStdout, ".warnings[]", `"missing package index for test:x86, future updates cannot be guaranteed"`) }) } + +func TestCoreListWhenNoPlatformAreInstalled(t *testing.T) { + env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t) + defer env.CleanUp() + + stdout, _, err := cli.Run("core", "list", "--format", "json") + require.NoError(t, err) + requirejson.Empty(t, stdout) + + stdout, _, err = cli.Run("core", "list") + require.NoError(t, err) + require.Equal(t, "No platforms installed.\n", string(stdout)) +}