@@ -23,7 +23,7 @@ import (
2323
2424// GetPlatforms returns a list of installed platforms, optionally filtered by
2525// those requiring an update.
26- func GetPlatforms (instanceID int32 , updatableOnly bool ) ([]* cores.PlatformRelease , error ) {
26+ func GetPlatforms (instanceID int32 , updatableOnly , all bool ) ([]* cores.PlatformRelease , error ) {
2727 i := commands .GetInstance (instanceID )
2828 if i == nil {
2929 return nil , errors .Errorf ("unable to find an instance with ID: %d" , instanceID )
@@ -34,16 +34,24 @@ func GetPlatforms(instanceID int32, updatableOnly bool) ([]*cores.PlatformReleas
3434 return nil , errors .New ("invalid instance" )
3535 }
3636
37+ if updatableOnly && all {
38+ return nil , errors .New ("can't use both updatableOnly and all flags at the same time" )
39+ }
40+
3741 res := []* cores.PlatformRelease {}
3842 for _ , targetPackage := range packageManager .Packages {
3943 for _ , platform := range targetPackage .Platforms {
40- if platformRelease := packageManager .GetInstalledPlatformRelease (platform ); platformRelease != nil {
44+ platformRelease := packageManager .GetInstalledPlatformRelease (platform )
45+ if all {
46+ res = append (res , platform .GetLatestRelease ())
47+ continue
48+ }
49+ if platformRelease != nil {
4150 if updatableOnly {
4251 if latest := platform .GetLatestRelease (); latest == nil || latest == platformRelease {
4352 continue
4453 }
4554 }
46-
4755 res = append (res , platformRelease )
4856 }
4957 }
0 commit comments