summaryrefslogtreecommitdiff
path: root/repomap.go
diff options
context:
space:
mode:
Diffstat (limited to 'repomap.go')
-rw-r--r--repomap.go50
1 files changed, 50 insertions, 0 deletions
diff --git a/repomap.go b/repomap.go
new file mode 100644
index 0000000..f41e637
--- /dev/null
+++ b/repomap.go
@@ -0,0 +1,50 @@
+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)
+ }
+ }
+}