x
This commit is contained in:
parent
6ea0ee469f
commit
17a4834749
@ -10,6 +10,7 @@ import (
|
||||
type Repo struct {
|
||||
Git string
|
||||
filename string
|
||||
ok bool
|
||||
}
|
||||
|
||||
var reposPath = ""
|
||||
@ -18,6 +19,13 @@ func (rp *Repo) init() {
|
||||
rp.filename = strings.Replace(strings.Replace(rp.Git, "https://", "", -1), "/", "_", -1)
|
||||
}
|
||||
|
||||
func (rp *Repo) exist() bool {
|
||||
if _, err := os.Stat(reposPath + "/" + rp.filename); err != nil {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func initRepos() {
|
||||
reposPath = ExecPath + "/repos"
|
||||
if _, err := os.Stat(reposPath); err != nil {
|
||||
@ -25,7 +33,7 @@ func initRepos() {
|
||||
}
|
||||
for _, repo := range Config.Repos {
|
||||
repo.init()
|
||||
if _, err := os.Stat(reposPath + "/" + repo.filename); err != nil {
|
||||
if !repo.exist() {
|
||||
repo.gitClone()
|
||||
}
|
||||
}
|
||||
@ -33,5 +41,6 @@ func initRepos() {
|
||||
|
||||
func (rp *Repo) gitClone() {
|
||||
cmd := exec.Command("sh", "-c", fmt.Sprintf("git clone %s %s", rp.Git, rp.filename))
|
||||
cmd.Path = reposPath
|
||||
cmd.Output()
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user