1
1
package list
2
2
3
3
import (
4
- "strings"
5
-
6
4
"github.com/fatih/color"
7
5
"github.com/urfave/cli/v2"
6
+ "slices"
7
+ "strings"
8
8
9
9
"github.com/ekristen/aws-nuke/v3/pkg/commands/global"
10
10
"github.com/ekristen/aws-nuke/v3/pkg/common"
11
11
12
- _ "github.com/ekristen/aws-nuke/v3/resources"
13
12
"github.com/ekristen/libnuke/pkg/registry"
13
+
14
+ _ "github.com/ekristen/aws-nuke/v3/resources"
14
15
)
15
16
16
17
func execute (c * cli.Context ) error {
@@ -21,19 +22,26 @@ func execute(c *cli.Context) error {
21
22
ls = registry .GetNames ()
22
23
}
23
24
25
+ slices .Sort (ls )
26
+
24
27
for _ , name := range ls {
25
- if strings .HasPrefix (name , "AWS::" ) {
28
+ reg := registry .GetRegistration (name )
29
+
30
+ if reg == nil {
26
31
continue
27
32
}
28
33
29
- reg := registry .GetRegistration (name )
30
-
31
34
if reg .AlternativeResource != "" {
32
- color .New (color .Bold ).Printf ("%-55s\n " , name )
35
+ color .New (color .Bold ).Printf ("%-59s" , name )
36
+ color .New (color .FgCyan ).Printf ("native resource\n " )
33
37
color .New (color .Bold , color .FgYellow ).Printf (" > %-55s" , reg .AlternativeResource )
34
- color .New (color .FgCyan ).Printf ("alternative cloud-control resource\n " )
38
+ color .New (color .FgHiBlue ).Printf ("alternative cloud-control resource\n " )
39
+ } else if strings .HasPrefix (reg .Name , "AWS::" ) {
40
+ color .New (color .Bold ).Printf ("%-59s" , name )
41
+ color .New (color .FgHiMagenta ).Printf ("cloud-control resource\n " )
35
42
} else {
36
- color .New (color .Bold ).Printf ("%-55s\n " , name )
43
+ color .New (color .Bold ).Printf ("%-59s" , name )
44
+ color .New (color .FgCyan ).Printf ("native resource\n " )
37
45
}
38
46
}
39
47
0 commit comments