on the way to somewhere

This commit is contained in:
Jeff Carr 2024-12-03 13:23:12 -06:00
parent c2bd3b64be
commit d1cc3bd09a
5 changed files with 30 additions and 10 deletions

View File

@ -36,6 +36,12 @@ redomod:
GO111MODULE= go mod init
GO111MODULE= go mod tidy
redomod-all:
./forge --RedoGoMod
redomod-erase:
./forge --RedoGoMod --erase
list: build
reset
./forge --list

View File

@ -21,6 +21,8 @@ type args struct {
Real bool `arg:"--fix" help:"fix config, save config & exit"`
Repomap string `arg:"--repomap" help:"parse a repomap from gowebd"`
Clone bool `arg:"--clone" help:"go-clone things you are missing"`
Force bool `arg:"--force" help:"force redo go-clone"`
Erase bool `arg:"--erase" help:"erase"`
}
func (args) Version() string {

11
list.go
View File

@ -51,13 +51,20 @@ func verifyPrint(repo *gitpb.Repo) {
os.Exit(0)
}
}
if me.forge.IsReadOnly(repo.GoPath) && !argv.ReadOnly {
if me.forge.IsReadOnly(repo) && !argv.ReadOnly {
if repo.ReadOnly {
return
}
log.Info("readonly flag on repo is wrong", repo.GoPath)
return
}
start := fmt.Sprintf("%-40s %-8s %-20s %-20s %-20s", s["gopath"], s["rtype"], s["cver"], s["mver"], s["cver"])
if s["url"] != "" {
end += "(" + s["url"] + ") "
}
if repo.ReadOnly {
end += "(readonly) "
}
// end += fmt.Sprintf("(%s,%s,%s,%s) ", s["mname"], s["dname"], s["uname"], s["cname"])
log.Info(start, end)
}
@ -76,7 +83,7 @@ func verify(repo *gitpb.Repo, s map[string]string) bool {
return false
}
// only verify the master branch name with read-only repos
if me.forge.IsReadOnly(repo.GoPath) {
if me.forge.IsReadOnly(repo) {
s["mver"] = repo.GetMasterVersion()
return true
}

14
main.go
View File

@ -30,9 +30,10 @@ func main() {
list()
scan()
repomap()
os.Exit(0)
if argv.RedoGoMod {
me.forge.RillRedoGoMod()
os.Exit(0)
repos := me.forge.Repos.SortByGoPath()
for repos.Scan() {
repo := repos.Next()
@ -40,14 +41,15 @@ func main() {
log.Printf("%10s %-50s", "old?", repo.GetGoPath())
continue
}
if me.forge.IsReadOnly(repo.GetGoPath()) {
log.Printf("%10s %-50s", "readonly", repo.GetGoPath())
continue
log.Printf("running on: %-50s", repo.GetGoPath())
if argv.Erase {
repo.EraseGoMod()
} else {
repo.RedoGoMod()
}
repo.RedoGoMod()
}
os.Exit(0)
}
os.Exit(0)
me.myGui = gui.New()
me.myGui.Default()

View File

@ -30,10 +30,13 @@ func repomap() {
comment = strings.Join(parts[2:], " ")
}
repo := me.forge.Repos.FindByGoPath(gopath)
if argv.Force && argv.Clone {
cmd := []string{"go-clone", "--recursive", gopath}
shell.RunRealtime(cmd)
continue
}
if repo == nil {
if argv.Clone {
cmd := []string{"go-clone", "--recursive", gopath}
shell.RunRealtime(cmd)
// me.forge.Clone(gopath)
} else {
log.Info(gopath, "need to clone")