Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: list alphabetically, show cloud-control resources separate #65

Merged
merged 2 commits into from
Feb 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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