Skip to content

Commit

Permalink
feat: list alphabetically, show cloud-control resources separate (#65)
Browse files Browse the repository at this point in the history
* feat: list alphabetically, show cloud-control resources separate

* fix: go import order
  • Loading branch information
ekristen authored Feb 4, 2024
1 parent c6f370b commit 930b03a
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions pkg/commands/list/list.go
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 930b03a

Please sign in to comment.