-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
50 lines (46 loc) · 891 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
package main
import (
"log"
"os"
"github.com/jqiris/week-report/core"
"github.com/urfave/cli/v2"
)
func main() {
app := &cli.App{
Name: "week-report",
Usage: "通过git使用记录产生周报",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "conf",
Aliases: []string{"c"},
Value: "config.json",
Usage: "指定配置文件",
},
&cli.TimestampFlag{
Name: "sdate",
Aliases: []string{"s"},
Layout: "20060102",
Usage: "日报开始日期",
},
&cli.TimestampFlag{
Name: "edate",
Aliases: []string{"e"},
Layout: "20060102",
Usage: "日报结束日期",
},
},
Commands: []*cli.Command{
{
Name: "run",
Aliases: []string{"r"},
Usage: "产生周报",
Before: core.Before,
Action: core.Report,
},
},
}
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}