-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.go
58 lines (51 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
55
56
57
58
package main
import(
"time"
"flag"
"strings"
"log"
"fmt"
"gopkg.in/libgit2/git2go.v22"
"github.com/searchspring/repo-tsar/tsar"
"github.com/searchspring/repo-tsar/config"
)
var configFileName string
var branch string
var repos string
var version bool
const (
versioninfo = "v0.1.4"
)
func main() {
// Parse commandline
flag.StringVar(&configFileName, "config", "repotsar.yml", "YAML config file")
flag.StringVar(&branch, "branch", "", "Create branch in repos")
flag.StringVar(&repos, "repos", "", "Non-spaced Comma separated list of repos (defaults to all)")
flag.BoolVar(&version, "version",false,"RepoTsar version")
flag.Parse()
if version == true {
fmt.Printf("RepoTsar version %s\n", versioninfo)
return
}
config,err := config.ReadConfig(configFileName)
if err != nil {
log.Fatal(err)
}
reposlist := strings.Split(repos, ",")
// Git Signature
signature := &git.Signature{
Name: config.Signature.Name,
Email: config.Signature.Email,
When: time.Now(),
}
tsar := &tsar.RepoTsar{
Config: config,
Branch: branch,
ReposList: reposlist,
Signature: signature,
}
err = tsar.Run()
if err != nil {
log.Fatal(err)
}
}