-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
44 lines (36 loc) · 925 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
package main
import (
"os"
"sync"
"github.com/jessevdk/go-flags"
)
func main() {
var opts struct {
User string `short:"u" long:"user" description:"the repo user" required:"false"`
Repo string `short:"r" long:"repo" description:"the repo name" required:"false"`
Service string `short:"s" long:"service" description:"the service to check (github/gitlab)" required:"false"`
}
_, err := flags.Parse(&opts)
if err != nil {
os.Exit(1)
}
autoUser, autoRepo, autoService := GetRemoteDetails()
if opts.User == "" {
opts.User = autoUser
}
if opts.Repo == "" {
opts.Repo = autoRepo
}
if opts.Service == "" {
opts.Service = autoService
}
var wg sync.WaitGroup
wg.Add(2)
go LastBuild(opts.User, opts.Repo, &wg)
if opts.Service == "gitlab" {
go GetGitlabIssues(opts.User, opts.Repo, &wg)
} else if opts.Service == "github" {
go GetGithubIssues(opts.User, opts.Repo, &wg)
}
wg.Wait()
}