forked from ethereum-optimism/superchain-registry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
52 lines (45 loc) · 1.07 KB
/
main.go
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
51
52
package main
import (
"fmt"
"os"
"github.com/ethereum-optimism/superchain-registry/ops/cmd"
"github.com/joho/godotenv"
"github.com/urfave/cli/v2"
)
var app = &cli.App{
Name: "ops",
Usage: "Utilities for working with the superchain-registry",
Commands: []*cli.Command{
&cmd.AddNewChainCmd,
&cmd.PromoteToStandardCmd,
&cmd.CheckRollupConfigCmd,
&cmd.CompressGenesisCmd,
&cmd.CheckGenesisCmd,
&cmd.UpdateConfigsCmd,
},
}
func main() {
if err := runApp(os.Args); err != nil {
fmt.Println(err)
fmt.Println("*********************")
fmt.Printf("FAILED: %s\n", app.Name)
os.Exit(1)
}
fmt.Println("*********************")
fmt.Printf("SUCCESS: %s\n", app.Name)
}
func runApp(args []string) error {
// Load the appropriate .env file
var err error
if runningTests := os.Getenv("SCR_RUN_TESTS"); runningTests == "true" {
fmt.Println("Loading .env.test")
err = godotenv.Load("./testdata/.env.test")
} else {
err = godotenv.Load()
}
if err != nil && !os.IsNotExist(err) {
fmt.Println(err)
panic("error loading .env file")
}
return app.Run(args)
}