Skip to content

Commit

Permalink
feat: list alphabetically, show cloud-control resources separate
Browse files Browse the repository at this point in the history
  • Loading branch information
ekristen committed Feb 4, 2024
1 parent c6f370b commit ac0268f
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions pkg/commands/list/list.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package list

import (
"github.com/ekristen/aws-nuke/pkg/nuke"
"github.com/ekristen/libnuke/pkg/resource"
"github.com/fatih/color"
"github.com/urfave/cli/v2"
"sort"
"strings"

"github.com/ekristen/aws-nuke/pkg/commands/global"
"github.com/ekristen/aws-nuke/pkg/common"
Expand All @@ -13,10 +14,24 @@ import (
)

func execute(c *cli.Context) error {
ls := resource.GetListersForScope(nuke.Account)
ls := resource.GetNames()

for name, _ := range ls {
color.New(color.Bold).Printf("%-55s\n", name)
sort.Strings(ls)

for _, name := range ls {
if strings.HasPrefix(name, "AWS::") {
continue
}

reg := resource.GetRegistration(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
Expand Down

0 comments on commit ac0268f

Please sign in to comment.