Unverified Commit df127864 authored by Alessio Perugini's avatar Alessio Perugini Committed by GitHub

When launching `core list` with no installed platforms print `no platforms installed` (#2238)

parent 0f516bb6
......@@ -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 {
......
......@@ -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))
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment