-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
45 lines (40 loc) · 931 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
package main
import (
"flag"
"fmt"
"os"
"github.com/MovieStoreGuy/go-gitprs/service"
"github.com/fatih/color"
)
var (
token string
org, team string
)
func init() {
const (
blank = ""
)
flag.StringVar(&token, "token", blank, "the github token to be used with the client")
flag.StringVar(&org, "org", blank, "the organisation to examine")
flag.StringVar(&team, "team", blank, "the team to examine")
}
func main() {
flag.Parse()
projects, err := service.New(org, team, token).GetOpenPrs()
if err != nil {
fmt.Println("Unable to process prs due to:", err)
flag.Usage()
os.Exit(-1)
}
for project := range projects {
if project.Error != nil {
color.Red("Issue with getting Project information due to: %v", project.Error)
continue
}
color.Green("Project: %v", project.Name)
for _, pr := range project.PullRequests {
color.Yellow("\t%v", pr.Title)
color.Blue("\t%v", pr.Link)
}
}
}