forked from ekristen/aws-nuke
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
50 lines (42 loc) · 1.19 KB
/
main.go
File metadata and controls
50 lines (42 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package main
import (
"context"
"os"
"github.com/sirupsen/logrus"
"github.com/urfave/cli/v3"
"github.com/ekristen/aws-nuke/v3/pkg/common"
_ "github.com/ekristen/aws-nuke/v3/pkg/commands/account"
_ "github.com/ekristen/aws-nuke/v3/pkg/commands/completion"
_ "github.com/ekristen/aws-nuke/v3/pkg/commands/config"
_ "github.com/ekristen/aws-nuke/v3/pkg/commands/list"
_ "github.com/ekristen/aws-nuke/v3/pkg/commands/nuke"
_ "github.com/ekristen/aws-nuke/v3/pkg/commands/version"
_ "github.com/ekristen/aws-nuke/v3/resources"
)
func main() {
defer func() {
if r := recover(); r != nil {
// log panics forces exit
if _, ok := r.(*logrus.Entry); ok {
os.Exit(1)
}
panic(r)
}
}()
app := &cli.Command{
Name: common.AppVersion.Name,
Usage: "remove everything from an aws account",
Version: common.AppVersion.Summary,
Authors: []any{
"Erik Kristensen <erik@erikkristensen.com>",
},
Commands: common.GetCommands(),
CommandNotFound: func(ctx context.Context, command *cli.Command, s string) {
logrus.Fatalf("Command %s not found.", s)
},
EnableShellCompletion: true,
}
if err := app.Run(context.Background(), os.Args); err != nil {
logrus.Fatal(err)
}
}