diff --git a/pkg/commands/list/list.go b/pkg/commands/list/list.go index 36d22a01..dca20b1a 100644 --- a/pkg/commands/list/list.go +++ b/pkg/commands/list/list.go @@ -1,22 +1,39 @@ package list import ( - "github.com/ekristen/aws-nuke/pkg/nuke" - "github.com/ekristen/libnuke/pkg/resource" + "sort" + "strings" + "github.com/fatih/color" "github.com/urfave/cli/v2" "github.com/ekristen/aws-nuke/pkg/commands/global" "github.com/ekristen/aws-nuke/pkg/common" + "github.com/ekristen/libnuke/pkg/resource" + _ "github.com/ekristen/aws-nuke/resources" ) func execute(c *cli.Context) error { - ls := resource.GetListersForScope(nuke.Account) + ls := resource.GetNames() + + sort.Strings(ls) + + for _, name := range ls { + if strings.HasPrefix(name, "AWS::") { + continue + } + + reg := resource.GetRegistration(name) - for name, _ := range ls { - color.New(color.Bold).Printf("%-55s\n", name) + if reg.AlternativeResource != "" { + color.New(color.Bold).Printf("%-55s\n", name) + color.New(color.Bold, color.FgYellow).Printf(" > %-55s", reg.AlternativeResource) + color.New(color.FgCyan).Printf("alternative cloud-control resource\n") + } else { + color.New(color.Bold).Printf("%-55s\n", name) + } } return nil