@@ -23,7 +23,7 @@ import (
23
23
24
24
// GetPlatforms returns a list of installed platforms, optionally filtered by
25
25
// 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 ) {
27
27
i := commands .GetInstance (instanceID )
28
28
if i == nil {
29
29
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
34
34
return nil , errors .New ("invalid instance" )
35
35
}
36
36
37
+ if updatableOnly && all {
38
+ return nil , errors .New ("can't use both updatableOnly and all flags at the same time" )
39
+ }
40
+
37
41
res := []* cores.PlatformRelease {}
38
42
for _ , targetPackage := range packageManager .Packages {
39
43
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 {
41
50
if updatableOnly {
42
51
if latest := platform .GetLatestRelease (); latest == nil || latest == platformRelease {
43
52
continue
44
53
}
45
54
}
46
-
47
55
res = append (res , platformRelease )
48
56
}
49
57
}
0 commit comments