-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
54 lines (47 loc) · 1.14 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
package main
import (
"context"
"log"
"os"
"github.com/breathingdust/thumbsup/command"
"github.com/mitchellh/cli"
)
func main() {
username := os.Getenv("GITHUB_USER")
password := os.Getenv("GITHUB_TOKEN")
ctx := context.Background()
c := cli.NewCLI("thumbsup", "1.0.0")
c.Args = os.Args[1:]
c.Commands = map[string]cli.CommandFactory{
"service-stats": func() (cli.Command, error) {
return &command.ServiceStatsCommand{
Username: username,
Password: password,
}, nil
},
"top-core-issues": func() (cli.Command, error) {
return &command.CoreServiceReactionsCommand{
Username: username,
Password: password,
}, nil
},
"aggregated-issue-reactions": func() (cli.Command, error) {
return &command.AggregatedIssueReactionsCommand{}, nil
},
"issue-pullrequest-reactions": func() (cli.Command, error) {
return &command.IssuePullRequestReactionsCommand{
Context: ctx,
}, nil
},
"issues-by-service": func() (cli.Command, error) {
return &command.IssuesByServiceCommand{
Context: ctx,
}, nil
},
}
exitStatus, err := c.Run()
if err != nil {
log.Println(err)
}
os.Exit(exitStatus)
}