-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgitfeed.go
More file actions
53 lines (49 loc) · 1.12 KB
/
gitfeed.go
File metadata and controls
53 lines (49 loc) · 1.12 KB
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
package main
import (
"os"
"time"
"github.com/urfave/cli"
)
func main() {
app := cli.NewApp()
app.Name = "gitfeed"
app.Usage = "Check GitHub Newsfeed."
app.Version = "0.0.1"
app.Author = "maiyang"
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "config,c",
Value: "",
Usage: "Load configuration from `FILE` (default:~/.gitfeed/gitfeed.ini)",
},
cli.StringFlag{
Name: "user,u",
Value: "",
Usage: "Github username",
},
cli.StringFlag{
Name: "include,i",
Value: "",
Usage: "Include words. Wildcard pattern matching with support for '?' and '*'",
},
cli.StringFlag{
Name: "exclude,e",
Value: "",
Usage: "Exclude words. Wildcard pattern matching with support for '?' and '*'",
},
}
app.Action = func(c *cli.Context) error {
cfgInfo := LoadGitFeedCfg(c)
name := cfgInfo.Username
maxPage := cfgInfo.MaxPage
debug := cfgInfo.Debug
if len(name) > 0 && maxPage > 0 {
startTime := time.Now()
// 这里是整个功能的入口
ReceivedEvents(name, maxPage, debug, c.String("include"), c.String("exclude"))
cost("Total", startTime)
}
return nil
}
app.Run(os.Args)
}