-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.go
68 lines (59 loc) · 1004 Bytes
/
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package main
import (
"os"
"github.com/polynetwork/bridge-common/log"
"github.com/urfave/cli/v2"
)
func main() {
app := &cli.App{
Name: "zion-test",
Usage: "zion test framework",
Action: start,
Before: Init,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "config",
Value: "config.json",
},
&cli.StringFlag{
Name: "excel",
Value: "testcase.xlsx",
Usage: "test case excel file",
},
},
Commands: cli.Commands{
{
Name: "dump",
Action: dump,
},
{
Name: "spawn",
Action: runChain,
},
{
Name: "stop",
Action: stopChain,
},
},
}
err := app.Run(os.Args)
if err != nil {
log.Fatal("Start failure", "err", err)
}
}
func start(ctx *cli.Context) (err error) {
err = Run()
return
}
func Init(ctx *cli.Context) (err error) {
log.Init(nil)
err = NewConfig(ctx.String("config"))
if err != nil {
return
}
if len(CONFIG.Input) == 0 {
CONFIG.Input = ctx.String("excel")
}
err = Setup()
return
}