-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathmain.go
52 lines (43 loc) · 1.07 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
package main
import (
"log"
"os"
)
// MaxConcurrentClones is the upper limit of the maximum number of
// concurrent git clones
const MaxConcurrentClones = 20
const defaultMaxUserMigrationRetry = 5
var gitHostToken string
var useHTTPSClone *bool
var ignorePrivate *bool
var gitHostUsername string
// The services we know of and their default public host names
var knownServices = map[string]string{
"github": "github.com",
"gitlab": "gitlab.com",
"bitbucket": "bitbucket.org",
}
func main() {
c, err := initConfig(os.Args[1:])
if err != nil {
log.Fatal(err)
}
err = validateConfig(c)
if err != nil {
log.Fatal(err)
}
client := newClient(c.service, c.gitHostURL)
var executionErr error
// TODO implement validation of options so that we don't
// allow multiple operations at one go
if c.githubListUserMigrations {
handleGithubListUserMigrations(client, c)
} else if c.githubCreateUserMigration {
handleGithubCreateUserMigration(client, c)
} else {
executionErr = handleGitRepositoryClone(client, c)
}
if executionErr != nil {
log.Fatal(executionErr)
}
}