From 1928ac7e7c4553b309fc9760a49fef8f8e15b11a Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 18 Jan 2024 16:21:43 -0600 Subject: [PATCH] ready for another attempt at an auto-rebuild Signed-off-by: Jeff Carr --- globalBuildOptions.go | 52 +++++++++++++++++++++++++++++++++++++---- globalDisplayOptions.go | 6 ++--- globalResetOptions.go | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- unix.go | 2 -- 6 files changed, 54 insertions(+), 16 deletions(-) diff --git a/globalBuildOptions.go b/globalBuildOptions.go index 6d4f179..28fd69b 100644 --- a/globalBuildOptions.go +++ b/globalBuildOptions.go @@ -21,13 +21,26 @@ func doesExist(path string) bool { return true } +var quickCmds [][]string +var quickCmdLastPath string +var quickCmdDoNotRun bool = false + // only errors on bad errors func quickCmd(fullpath string, cmd []string) bool { var err error var b bool var output string + if quickCmdLastPath != fullpath { + quickCmds = append(quickCmds, []string{"cd", fullpath}) + quickCmdLastPath = fullpath + } + quickCmds = append(quickCmds, cmd) log.Warn("RUN:", fullpath, cmd) + if quickCmdDoNotRun { + return false + } + err, b, output = repostatus.RunCmd(fullpath, cmd) if err != nil { log.Error(err) @@ -74,7 +87,22 @@ func globalBuildOptions(box *gui.Node) { me.mainBranch.Disable() } + groupvbox.NewButton("git status", func() { + quickCmdDoNotRun = false + quickCmdLastPath = "~/go/src" + quickCmds = [][]string{} + log.Warn("scanning allrepos") + for _, path := range me.allrepos { + fullpath := "/home/jcarr/go/src/" + path + quickCmd(fullpath, []string{"git", "status"}) + } + }) + groupvbox.NewButton("rebuild autotypist", func() { + quickCmdDoNotRun = true + quickCmdLastPath = "~/go/src" + quickCmds = [][]string{} + log.Warn("scanning allrepos") fullpath := "/home/jcarr/go/src" quickCmd(fullpath, []string{"mkdir", "-p", "go.wit.com/apps/"}) @@ -87,10 +115,15 @@ func globalBuildOptions(box *gui.Node) { fullpath = "/home/jcarr/go/src/go.wit.com/apps/autotypist" quickCmd(fullpath, []string{"go", "-v", "-x", "build"}) + me.script = quickCmds + setGitCommands() }) me.rerunGoMod = groupvbox.NewButton("re-run go mod & go tidy", func() { me.rerunGoMod.Disable() + quickCmdDoNotRun = true + quickCmdLastPath = "~/go/src" + quickCmds = [][]string{} log.Warn("scanning allrepos") os.Unsetenv("GO111MODULE") for _, path := range me.allrepos { @@ -104,13 +137,25 @@ func globalBuildOptions(box *gui.Node) { quickCmd(fullpath, []string{"rm", "go.mod", "go.sum"}) quickCmd(fullpath, []string{"go", "mod", "init"}) - log.Sleep(.1) // don't hammer google's golang versioning system + // don't hammer google's golang versioning system + if quickCmdDoNotRun { + quickCmd(fullpath, []string{"sleep", ".2"}) + } else { + log.Sleep(.2) + } quickCmd(fullpath, []string{"go", "mod", "tidy"}) - log.Sleep(.2) // don't hammer google's golang versioning system + // don't hammer google's golang versioning system + if quickCmdDoNotRun { + quickCmd(fullpath, []string{"sleep", ".1"}) + } else { + log.Sleep(.1) + } quickCmd(fullpath, []string{"git", "status"}) // TODO: process this? } // re-enable the button me.rerunGoMod.SetText("re-run go mod & go tidy") + me.script = quickCmds + setGitCommands() me.rerunGoMod.Enable() }) setCurrentBranch = groupvbox.NewButton("set all branches to", func() { @@ -118,9 +163,6 @@ func globalBuildOptions(box *gui.Node) { for repo, path := range me.allrepos { log.Warn("found repo", repo.String()) var changeBranch [][]string - // realname, realversion := repo.status.CheckoutBranch(me.toMoveToBranch) - // log.Warn("GOT", realname, realversion) - // path := repo.status.GetPath() changeBranch = append(changeBranch, []string{"cd", "go/src/" + path}) changeBranch = append(changeBranch, []string{"git", "checkout", me.toMoveToBranch}) me.script = changeBranch diff --git a/globalDisplayOptions.go b/globalDisplayOptions.go index 79c1b23..6909003 100644 --- a/globalDisplayOptions.go +++ b/globalDisplayOptions.go @@ -14,7 +14,8 @@ func globalDisplayOptions(box *gui.Node) { // grouphbox := groupvbox.NewBox("bw hbox", true) groupvbox.NewButton("Show Repository Window", func() { - reposwin.Draw() + repoworld() + // reposwin.Draw() }) me.autoHidePerfect = groupvbox.NewCheckbox("Hide repos") me.autoHidePerfect.Custom = func() { @@ -60,9 +61,6 @@ func globalDisplayOptions(box *gui.Node) { repo.newScan() } }) - groupvbox.NewButton("repoworld()", func() { - repoworld() - }) } func hidePerfect() { diff --git a/globalResetOptions.go b/globalResetOptions.go index bd2f61a..8e5b77f 100644 --- a/globalResetOptions.go +++ b/globalResetOptions.go @@ -73,8 +73,8 @@ func globalResetOptions(box *gui.Node) { buildOptions.NewSeparator("endStatusScans") buildOptions.NewSeparator("endStatusScans") - buildOptions.NewLabel("cmd") - cmds = buildOptions.NewLabel("ls") + // buildOptions.NewLabel("cmd") + cmds = group2.NewTextbox("ls") buildOptions.NewLabel("--dry-run") dryrun = buildOptions.NewButton("show commands", func() { diff --git a/go.mod b/go.mod index 1061c52..15aef28 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.21.4 require ( go.wit.com/gui v0.12.16 go.wit.com/lib/gadgets v0.12.9 - go.wit.com/lib/gui/repostatus v0.12.12 + go.wit.com/lib/gui/repostatus v0.12.13 go.wit.com/log v0.5.5 ) diff --git a/go.sum b/go.sum index f7d1564..a037706 100644 --- a/go.sum +++ b/go.sum @@ -8,8 +8,8 @@ go.wit.com/gui v0.12.16 h1:GBiPiDyzkGCxwNegehHiONmNppaqyFZv7iteLUHJ/Po= go.wit.com/gui v0.12.16/go.mod h1:27+THr2a84GZ61KKUuN30WYnYoSsBewllUKc+fnWLto= go.wit.com/lib/gadgets v0.12.9 h1:yayXQDiAENfMElRMeh7Yab1f6HNkiy5Aw6KNP5Wd1DI= go.wit.com/lib/gadgets v0.12.9/go.mod h1:Hb/vSiW22hPJjTVA1mShQ6HuqQ7dHGB95WLEfZlPO3M= -go.wit.com/lib/gui/repostatus v0.12.12 h1:l4mCK/M/QAOuFu+q6F/qVxKtt/+gxLPqTSMdJby+jAY= -go.wit.com/lib/gui/repostatus v0.12.12/go.mod h1:GqLGG3lxcnKQhmVwqE+G5uQoRwN+KdErPCWOHGABrEw= +go.wit.com/lib/gui/repostatus v0.12.13 h1:kumPC2wEYjAk+mCQzjrNfcr40CY0qaXva4EjfW0kExk= +go.wit.com/lib/gui/repostatus v0.12.13/go.mod h1:QxWg6Ml68eiz7mhrX+pF0oXHtixpzllaEi1XDP/VaH4= go.wit.com/log v0.5.5 h1:bK3b94uVKgev4jB5wg06FnvCFBEapQICTSH2YW+CWr4= go.wit.com/log v0.5.5/go.mod h1:BaJBfHFqcJSJLXGQ9RHi3XVhPgsStxSMZRlaRxW4kAo= go.wit.com/widget v1.1.5 h1:jx5hJ2WLZJnCcvMuaLHegzpNlzwo+0kOkzsRkzRiB30= diff --git a/unix.go b/unix.go index 28814c2..d03964a 100644 --- a/unix.go +++ b/unix.go @@ -1,8 +1,6 @@ package main import ( - "errors" - "os/exec" "strings" "go.wit.com/lib/gui/repostatus"