Skip to content

Commit

Permalink
cli: change message when all platform are already up to date when pro…
Browse files Browse the repository at this point in the history
…viding --updatable
  • Loading branch information
alessio-perugini committed Aug 24, 2023
1 parent 58c6039 commit c0ca2e8
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions internal/cli/core/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ func runListCommand(args []string, all bool, updatableOnly bool) {
// List gets and prints a list of installed platforms.
func List(inst *rpc.Instance, all bool, updatableOnly bool) {
platforms := GetList(inst, all, updatableOnly)
feedback.PrintResult(installedResult{platforms})
feedback.PrintResult(installedResult{
platforms: platforms,
updatableOnly: updatableOnly,
})
}

// GetList returns a list of installed platforms.
Expand All @@ -74,7 +77,8 @@ func GetList(inst *rpc.Instance, all bool, updatableOnly bool) []*rpc.Platform {
// output from this command requires special formatting, let's create a dedicated
// feedback.Result implementation
type installedResult struct {
platforms []*rpc.Platform
platforms []*rpc.Platform
updatableOnly bool
}

func (ir installedResult) Data() interface{} {
Expand All @@ -83,6 +87,9 @@ func (ir installedResult) Data() interface{} {

func (ir installedResult) String() string {
if len(ir.platforms) == 0 {
if ir.updatableOnly {
return tr("All platforms are up to date.")
}
return tr("No platforms installed.")
}
t := table.New()
Expand Down

0 comments on commit c0ca2e8

Please sign in to comment.