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 (
"errors"
"fmt"
"os"
"github.com/urfave/cli/v2"
"github.com/ethereum/go-ethereum/log"
oplog "github.com/ethereum-optimism/optimism/op-service/log"
wheel "github.com/ethereum-optimism/optimism/op-wheel"
)
var (
Version = ""
GitCommit = ""
GitDate = ""
)
func main() {
app := cli.NewApp()
app.Version = fmt.Sprintf("%s-%s-%s", Version, GitCommit, GitDate)
app.Name = "op-wheel"
app.Usage = "Optimism Wheel is a CLI tool for the execution engine"
app.Description = "Optimism Wheel is a CLI tool to direct the engine one way or the other with DB cheats and Engine API routines."
app.Flags = []cli.Flag{wheel.GlobalGethLogLvlFlag}
app.Before = func(c *cli.Context) error {
log.Root().SetHandler(
log.LvlFilterHandler(
oplog.Level(c.String(wheel.GlobalGethLogLvlFlag.Name)),
log.StreamHandler(os.Stdout, log.TerminalFormat(true)),
),
)
return nil
}
app.Action = cli.ActionFunc(func(c *cli.Context) error {
return errors.New("see 'cheat' and 'engine' subcommands and --help")
})
app.Writer = os.Stdout
app.ErrWriter = os.Stderr
app.Commands = []*cli.Command{
wheel.CheatCmd,
wheel.EngineCmd,
}
err := app.Run(os.Args)
if err != nil {
log.Crit("Application failed", "message", err)
}
}