-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
108 lines (103 loc) · 2.38 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
package main
import (
"log"
"os"
"time"
"github.com/urfave/cli/v2"
"github.com/penguin-statistics/soracli/cmd"
)
func main() {
app := &cli.App{
Name: "soracli",
Usage: "Penguin Statistics Admin CLI",
Commands: []*cli.Command{
{
Name: "render",
Aliases: []string{"r"},
Usage: "renders a new game data",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "ark-zone-id",
Aliases: []string{"zi"},
Usage: "ark zone ID",
Required: true,
},
&cli.StringFlag{
Name: "zone-name",
Aliases: []string{"zn"},
Usage: "zone name",
Required: true,
},
&cli.StringFlag{
Name: "zone-category",
Aliases: []string{"zc"},
Usage: "zone category",
Required: true,
},
&cli.StringFlag{
Name: "zone-type",
Aliases: []string{"zt"},
Usage: "zone type",
},
&cli.StringFlag{
Name: "server",
Aliases: []string{"s"},
Usage: "server",
Required: true,
},
&cli.TimestampFlag{
Name: "start-time",
Aliases: []string{"st"},
Usage: "zone start time",
Required: true,
Layout: time.RFC3339,
},
&cli.TimestampFlag{
Name: "end-time",
Aliases: []string{"et"},
Usage: "zone end time",
Layout: time.RFC3339,
},
&cli.StringFlag{
Name: "editor",
Aliases: []string{"e"},
Usage: "editor",
Value: os.Getenv("EDITOR"),
},
},
Action: func(c *cli.Context) error {
return cmd.Render(c)
},
},
},
Flags: []cli.Flag{
&cli.StringFlag{
Name: "baseUrl",
Aliases: []string{"u"},
Usage: "base url of the admin api, without trailing slash",
Required: false,
Value: "https://penguin-stats.io/api/admin",
},
&cli.StringFlag{
Name: "sourceUrl",
Usage: "source url of the json data",
Required: false,
Value: "https://raw.githubusercontent.com/Kengxxiao/ArknightsGameData/master/zh_CN/gamedata/excel/stage_table.json",
},
&cli.StringFlag{
Name: "token",
Usage: "bearer token for authentication to the admin api; required",
Required: true,
},
&cli.BoolFlag{
Name: "verbose",
Aliases: []string{"v"},
Usage: "verbose output",
},
},
}
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}