-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgit-mirror.go
More file actions
49 lines (40 loc) · 798 Bytes
/
git-mirror.go
File metadata and controls
49 lines (40 loc) · 798 Bytes
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
package main
import (
"fmt"
"os"
)
// start here
func main() {
m, err := parseCommandLine()
if err != nil {
panic(err)
}
// load, parse and validate repository list
if err = m.loadRepositoryList(); err != nil {
panic(err)
}
// print summary report
fmt.Println("> Found repositories:", len(m.repoList))
fmt.Println("> Concurrency:", m.concurrentJobs)
if m.cleanupCacheDir {
fmt.Println("> Cache is disabled, using temporary directory...")
} else {
fmt.Println("> Cache will be stored in:", m.cacheDir)
}
// perform sync
chDone, chOut, chErr := m.process()
exitCode := 0
done:
for {
select {
case line := <-chOut:
fmt.Println(line)
case err := <-chErr:
fmt.Println(err.Error())
exitCode = 1
case <-chDone:
break done
}
}
os.Exit(exitCode)
}