54 lines
995 B
Go
54 lines
995 B
Go
// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
|
|
// Use of this source code is governed by the GPL 3.0
|
|
|
|
package main
|
|
|
|
import (
|
|
"os"
|
|
"strings"
|
|
|
|
"go.wit.com/lib/gui/shell"
|
|
"go.wit.com/log"
|
|
)
|
|
|
|
//
|
|
// go-clone everything from a gowebd repomap file (go.wit.com has examples)
|
|
//
|
|
|
|
func repomap(filename string) {
|
|
log.DaemonMode(true)
|
|
|
|
data, err := os.ReadFile(argv.RepoMap)
|
|
if err != nil {
|
|
log.Info("open repomap failed", err)
|
|
return
|
|
}
|
|
|
|
for _, line := range strings.Split(string(data), "\n") {
|
|
if line == "" {
|
|
continue
|
|
}
|
|
if strings.HasPrefix(line, "#") {
|
|
continue
|
|
}
|
|
parts := strings.Fields(line)
|
|
gopath := parts[0]
|
|
repo := me.forge.FindByGoPath(gopath)
|
|
var cmd []string
|
|
if argv.Recursive {
|
|
cmd = []string{"go-clone", "--recursive", gopath}
|
|
} else {
|
|
cmd = []string{"go-clone", gopath}
|
|
}
|
|
if repo == nil {
|
|
if argv.DryRun {
|
|
log.Info("run:", cmd)
|
|
} else {
|
|
shell.RunRealtime(cmd)
|
|
}
|
|
} else {
|
|
log.Info("already ran:", cmd)
|
|
}
|
|
}
|
|
}
|