diff --git a/Makefile b/Makefile index d45d1f4..f78ec44 100644 --- a/Makefile +++ b/Makefile @@ -9,10 +9,10 @@ build: echo "build it!" goimports -w *.go -rm resources/*.so + cp ~/go/src/go.wit.com/toolkits/*.so resources/ go build -v -x install: - cp ~/go/src/go.wit.com/toolkits/*.so resources/ rm -f ~/go/src/go.wit.com/toolkits/*.so go install -v -x autotypist diff --git a/globalBuildOptions.go b/globalBuildOptions.go index b140e60..a401e21 100644 --- a/globalBuildOptions.go +++ b/globalBuildOptions.go @@ -84,7 +84,7 @@ func globalBuildOptions(box *gui.Node) { guiBranch.AddText("jcarr") guiBranch.Custom = func() { me.toMoveToBranch = guiBranch.String() - setCurrentBranch.Set("set all branches to " + me.toMoveToBranch) + setCurrentBranch.SetLabel("set all branches to " + me.toMoveToBranch) me.mainBranch.Disable() } @@ -105,62 +105,45 @@ func globalBuildOptions(box *gui.Node) { quickCmdLastPath = "~/go/src" quickCmds = [][]string{} log.Warn("scanning allrepos") - fullpath := "/home/jcarr/go/src" - quickCmd(fullpath, []string{"mkdir", "-p", "go.wit.com/apps/"}) + fullpath := "/home/jcarr/" + quickCmd(fullpath, []string{"mkdir", "-p", "/home/jcarr/go/src/go.wit.com/apps/"}) + fullpath = "/home/jcarr/go/src/go.wit.com/apps/" + quickCmd(fullpath, []string{"go", "get", "go.wit.com/apps/autotypist"}) fullpath = "/home/jcarr/go/src/go.wit.com/apps/autotypist" - quickCmd(fullpath, []string{"go", "get", "-v", "go.wit.com/apps/autotypist"}) quickCmd(fullpath, []string{"go", "get", "-v", "go.wit.com/toolkits/debian"}) fullpath = "/home/jcarr/go/src/go.wit.com/toolkits/debian" + quickCmd(fullpath, []string{"make", "download"}) quickCmd(fullpath, []string{"make"}) fullpath = "/home/jcarr/go/src/go.wit.com/apps/autotypist" quickCmd(fullpath, []string{"go", "get", "-v", "-u", "."}) - quickCmd(fullpath, []string{"go", "-v", "-x", "build"}) + quickCmd(fullpath, []string{"go", "build", "-v", "-x"}) me.script = quickCmds setGitCommands() }) + me.rerunGoMod = groupvbox.NewButton("remove all go.mod and go.sum", func() { + quickCmdDoNotRun = false + log.Warn("scanning allrepos") + for _, path := range me.allrepos { + fullpath := "/home/jcarr/go/src/" + path + quickCmd(fullpath, []string{"rm", "-f", "go.mod", "go.sum"}) + } + }) + 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") + quickCmdDoNotRun = false os.Unsetenv("GO111MODULE") + log.Warn("scanning allrepos") for _, path := range me.allrepos { fullpath := "/home/jcarr/go/src/" + path - // set the button text for the user - me.rerunGoMod.SetText("Running go.mod " + fullpath) - - quickCmd(fullpath, []string{"pwd"}) - quickCmd(fullpath, []string{"ls", "-l"}) - quickCmd(fullpath, []string{"git", "status"}) // TODO: process this? - quickCmd(fullpath, []string{"rm", "go.mod", "go.sum"}) - quickCmd(fullpath, []string{"go", "mod", "init"}) - // 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"}) - // 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() { log.Warn("scanning allrepos") for repo, path := range me.allrepos { diff --git a/globalDisplayOptions.go b/globalDisplayOptions.go index 6909003..f2595dd 100644 --- a/globalDisplayOptions.go +++ b/globalDisplayOptions.go @@ -2,8 +2,6 @@ package main import ( - "go.wit.com/log" - "go.wit.com/gui" // "go.wit.com/gui/gadgets" ) @@ -14,42 +12,29 @@ func globalDisplayOptions(box *gui.Node) { // grouphbox := groupvbox.NewBox("bw hbox", true) groupvbox.NewButton("Show Repository Window", func() { - repoworld() - // reposwin.Draw() + // repoworld() + reposwin.Toggle() }) - me.autoHidePerfect = groupvbox.NewCheckbox("Hide repos") + me.autoHidePerfect = groupvbox.NewCheckbox("Hide Perfectly clean repos").SetChecked(true) me.autoHidePerfect.Custom = func() { - me.autoHidePerfect.SetText("Hide Perfectly clean repos") - if me.autoHidePerfect.Bool() { - log.Warn("Should hide here") + if me.autoHidePerfect.Checked() { + hidePerfect() } else { - log.Warn("Should show here") + showAll() } } - me.autoHidePerfect.Set(true) - groupvbox.NewButton("hide perfect", func() { - me.autoHidePerfect.SetText("Hide Perfectly clean repos") - hidePerfect() - }) groupvbox.NewButton("show all", func() { for repo, _ := range me.allrepos { if repo.dirtyLabel.String() == "PERFECT" { if repo.hidden { - repo.show() + repo.Show() } // return } } }) - groupvbox.NewButton("reposwin.Hide()", func() { - reposwin.Hide() - }) - groupvbox.NewButton("reposwin.Show()", func() { - reposwin.Show() - }) - groupvbox.NewButton("status.Update() all", func() { for repo, _ := range me.allrepos { repo.status.Update() @@ -69,40 +54,17 @@ func hidePerfect() { if repo.hidden { continue } - repo.hide() + repo.Hide() // return } } } -func (r *repo) hide() { - r.pLabel.Hide() - r.lastTag.Hide() - r.vLabel.Hide() - - r.masterName.Hide() - r.masterVersion.Hide() - r.develName.Hide() - r.develVersion.Hide() - r.userName.Hide() - r.userVersion.Hide() - r.dirtyLabel.Hide() - r.showButton.Hide() - r.hidden = true -} - -func (r *repo) show() { - r.pLabel.Show() - r.lastTag.Show() - r.vLabel.Show() - - r.masterName.Show() - r.masterVersion.Show() - r.develName.Show() - r.develVersion.Show() - r.userName.Show() - r.userVersion.Show() - r.dirtyLabel.Show() - r.showButton.Show() - r.hidden = false +func showAll() { + for repo, _ := range me.allrepos { + if repo.hidden { + repo.Show() + repo.hidden = false + } + } } diff --git a/globalResetOptions.go b/globalResetOptions.go index 8e5b77f..b75c776 100644 --- a/globalResetOptions.go +++ b/globalResetOptions.go @@ -56,7 +56,7 @@ func globalResetOptions(box *gui.Node) { break } } - newCmds = append(newCmds, []string{"cd", "."}) + newCmds = append(newCmds, []string{"cd", "/home/jcarr/"}) newCmds = append(newCmds, []string{"rm", "-rf", "go/src/"}) newCmds = append(newCmds, []string{"chmod", "700", "-R", "go/pkg/"}) newCmds = append(newCmds, []string{"rm", "-rf", "go/pkg/"}) diff --git a/go.mod b/go.mod deleted file mode 100644 index c3727e3..0000000 --- a/go.mod +++ /dev/null @@ -1,20 +0,0 @@ -module go.wit.com/apps/autotypist - -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.13 - go.wit.com/log v0.5.5 -) - -require ( - github.com/hashicorp/errwrap v1.0.0 // indirect - github.com/hashicorp/go-multierror v1.0.0 // indirect - github.com/posener/complete v1.2.3 // indirect - go.wit.com/dev/alexflint/arg v1.4.5 // indirect - go.wit.com/dev/alexflint/scalar v1.2.1 // indirect - go.wit.com/dev/davecgh/spew v1.1.4 // indirect - go.wit.com/widget v1.1.5 // indirect -) diff --git a/go.sum b/go.sum deleted file mode 100644 index eafc70f..0000000 --- a/go.sum +++ /dev/null @@ -1,28 +0,0 @@ -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= -github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o= -github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/posener/complete v1.2.3 h1:NP0eAhjcjImqslEwo/1hq7gpajME0fTLTezBKDqfXqo= -github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -go.wit.com/dev/alexflint/arg v1.4.5 h1:asDx5f9IlfpknKjPBqqb2qndE91Pbo7ZDkWUgddfMhY= -go.wit.com/dev/alexflint/arg v1.4.5/go.mod h1:wnWc+c6z8kSdDKYriMf6RpM+FiXmo5RYp/t4FNi0MU0= -go.wit.com/dev/alexflint/scalar v1.2.1 h1:loXOcbVnd+8YeJRLey+XXidecBiedMDO00zQ26TvKNs= -go.wit.com/dev/alexflint/scalar v1.2.1/go.mod h1:+rYsfxqdI2cwA8kJ7GCMwWbNJvfvWUurOCXLiwdTtSs= -go.wit.com/dev/davecgh/spew v1.1.4 h1:C9hj/rjlUpdK+E6aroyLjCbS5MFcyNUOuP1ICLWdNek= -go.wit.com/dev/davecgh/spew v1.1.4/go.mod h1:sihvWmnQ/09FWplnEmozt90CCVqBtGuPXM811tgfhFA= -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.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= -go.wit.com/widget v1.1.5/go.mod h1:I8tnD3x3ECbB/CRNnLCdC+uoyk7rK0AEkzK1bQYSqoQ= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/main.go b/main.go index 706b778..89ad900 100644 --- a/main.go +++ b/main.go @@ -25,7 +25,7 @@ func main() { me.myGui.Default() autotypistWindow() - // repoworld() + repoworld() log.Sleep(.3) // hidePerfect() gui.Watchdog() @@ -60,7 +60,7 @@ func addRepo(grid *gui.Node, path string, master string, devel string, user stri return } log.Warn("status window exists. trying TestDraw() here") - newRepo.status.Show() + newRepo.status.Toggle() newRepo.status.Update() }) if path == "" { @@ -68,9 +68,9 @@ func addRepo(grid *gui.Node, path string, master string, devel string, user stri newRepo.pButton.Hide() } newRepo.status = repostatus.New(me.myGui, newRepo.path) - newRepo.status.SetMasterName(master) - newRepo.status.SetDevelName(devel) - newRepo.status.SetUserName(user) + newRepo.status.SetMasterBranchName(master) + newRepo.status.SetDevelBranchName(devel) + newRepo.status.SetUserBranchName(user) newRepo.hidden = false newRepo.status.Update() newRepo.newScan() diff --git a/repolist.go b/repolist.go index 170627e..0f46f86 100644 --- a/repolist.go +++ b/repolist.go @@ -40,3 +40,39 @@ func myrepolist() []string { lines := strings.Split(out, "\n") return lines } + +func (r *repo) Hide() { + r.pLabel.Hide() + r.pButton.Hide() + r.cButton.Hide() + r.lastTag.Hide() + r.vLabel.Hide() + + r.masterName.Hide() + r.masterVersion.Hide() + r.develName.Hide() + r.develVersion.Hide() + r.userName.Hide() + r.userVersion.Hide() + r.dirtyLabel.Hide() + r.showButton.Hide() + r.hidden = true +} + +func (r *repo) Show() { + r.pLabel.Show() + r.pButton.Show() + r.cButton.Show() + r.lastTag.Show() + r.vLabel.Show() + + r.masterName.Show() + r.masterVersion.Show() + r.develName.Show() + r.develVersion.Show() + r.userName.Show() + r.userVersion.Show() + r.dirtyLabel.Show() + r.showButton.Show() + r.hidden = false +} diff --git a/scan.go b/scan.go index d02b6f2..3d8ae0f 100644 --- a/scan.go +++ b/scan.go @@ -19,41 +19,38 @@ func (r *repo) newScan() bool { log.Warn("repo does not exist", r.getPath()) return false } - mn := r.status.GetMasterName() - r.masterName.Set(mn) + mn := r.status.GetMasterBranchName() + r.masterName.SetLabel(mn) mv := r.status.GetMasterVersion() - r.masterVersion.Set(mv) + r.masterVersion.SetLabel(mv) - dn := r.status.GetDevelName() - r.develName.Set(dn) + dn := r.status.GetDevelBranchName() + r.develName.SetLabel(dn) dv := r.status.GetDevelVersion() - r.develVersion.Set(dv) + r.develVersion.SetLabel(dv) - un := r.status.GetUserName() - r.userName.Set(un) + un := r.status.GetUserBranchName() + r.userName.SetLabel(un) uv := r.status.GetUserVersion() - r.userVersion.Set(uv) + r.userVersion.SetLabel(uv) cbname := r.status.GetCurrentBranchName() cbversion := r.status.GetCurrentBranchVersion() lasttag := r.status.GetLastTagVersion() - r.lastTag.Set(lasttag) - r.vLabel.Set(cbname + " " + cbversion) + r.lastTag.SetLabel(lasttag) + r.vLabel.SetLabel(cbname + " " + cbversion) - status := r.getStatus() - if status == "dirty" { - r.dirtyLabel.Set(status) - return false - } - if status == "merge" { - r.dirtyLabel.Set(status) - return false + if r.status.Changed() { + log.Warn("should scan here") } + status := r.status.GetStatus() + r.dirtyLabel.SetLabel(status) if status == "PERFECT" { - r.dirtyLabel.Set(status) + if me.autoHidePerfect.Checked() { + r.Hide() + } return true } - r.dirtyLabel.Set("unknown " + status) return false } diff --git a/unix.go b/unix.go index e7e382b..575c066 100644 --- a/unix.go +++ b/unix.go @@ -64,5 +64,5 @@ func setGitCommands() { log.Warn("s =", s) tmp = append(tmp, s) } - cmds.Set(strings.Join(tmp, "\n")) + cmds.SetText(strings.Join(tmp, "\n")) }