diff --git a/globalBuildOptions.go b/globalBuildOptions.go index f54e8e4..a91b18f 100644 --- a/globalBuildOptions.go +++ b/globalBuildOptions.go @@ -1,14 +1,14 @@ // This is a simple example package main -import ( +import ( "os" "strings" "go.wit.com/log" "go.wit.com/gui/gui" - "go.wit.com/gui/gadgets" + "go.wit.com/lib/gadgets" ) func doesExist(path string) bool { @@ -26,7 +26,7 @@ func globalBuildOptions(box *gui.Node) { groupvbox := group1.NewBox("bw vbox", false) // grouphbox := groupvbox.NewBox("bw hbox", true) - grid := groupvbox.NewGrid("buildOptions",2, 1) + grid := groupvbox.NewGrid("buildOptions", 2, 1) me.mainBranch = gadgets.NewBasicCombobox(grid, "default main branch") me.mainBranch.AddText("guimain") @@ -47,12 +47,12 @@ func globalBuildOptions(box *gui.Node) { guiBranch.AddText("guimaster") guiBranch.AddText("guidevel") guiBranch.AddText("jcarr") - guiBranch.Custom = func () { + guiBranch.Custom = func() { me.toMoveToBranch = guiBranch.String() setCurrentBranch.Set("set all branches to " + me.toMoveToBranch) me.mainBranch.Disable() } - setCurrentBranch = groupvbox.NewButton("set all branches to", func () { + setCurrentBranch = groupvbox.NewButton("set all branches to", func() { for _, repo := range allrepos { var changeBranch [][]string // realname, realversion := repo.status.CheckoutBranch(me.toMoveToBranch) @@ -67,7 +67,7 @@ func globalBuildOptions(box *gui.Node) { } }) var everything *gui.Node - everything = groupvbox.NewButton("go get everything on go.wit.com", func () { + everything = groupvbox.NewButton("go get everything on go.wit.com", func() { var perfect bool = true var newCmds [][]string // usr, _ := user.Current() @@ -103,6 +103,6 @@ func globalBuildOptions(box *gui.Node) { doit.Enable() setGitCommands() }) - groupvbox.NewButton("build all apps", func () { + groupvbox.NewButton("build all apps", func() { }) } diff --git a/globalDisplayOptions.go b/globalDisplayOptions.go index 8f4cf52..996e701 100644 --- a/globalDisplayOptions.go +++ b/globalDisplayOptions.go @@ -1,7 +1,7 @@ // This is a simple example package main -import ( +import ( "go.wit.com/log" "go.wit.com/gui/gui" @@ -13,7 +13,7 @@ func globalDisplayOptions(box *gui.Node) { groupvbox := group1.NewBox("bw vbox", false) // grouphbox := groupvbox.NewBox("bw hbox", true) - groupvbox.NewButton("Show Repository Window", func () { + groupvbox.NewButton("Show Repository Window", func() { reposwin.Draw() }) me.autoHidePerfect = groupvbox.NewCheckbox("Hide repos") @@ -27,11 +27,11 @@ func globalDisplayOptions(box *gui.Node) { } me.autoHidePerfect.Set(true) - groupvbox.NewButton("hide perfect", func () { + groupvbox.NewButton("hide perfect", func() { me.autoHidePerfect.SetText("Hide Perfectly clean repos") hidePerfect() }) - groupvbox.NewButton("show all", func () { + groupvbox.NewButton("show all", func() { for _, repo := range allrepos { if repo.dirtyLabel.String() == "PERFECT" { if repo.hidden { @@ -42,25 +42,25 @@ func globalDisplayOptions(box *gui.Node) { } }) - groupvbox.NewButton("reposwin.Hide()", func () { + groupvbox.NewButton("reposwin.Hide()", func() { reposwin.Hide() }) - groupvbox.NewButton("reposwin.Show()", func () { + groupvbox.NewButton("reposwin.Show()", func() { reposwin.Show() }) - groupvbox.NewButton("status.Update() all", func () { + groupvbox.NewButton("status.Update() all", func() { for _, repo := range allrepos { repo.status.Update() } }) - groupvbox.NewButton("rescan all", func () { + groupvbox.NewButton("rescan all", func() { for _, repo := range allrepos { repo.newScan() } }) - groupvbox.NewButton("repoworld()", func () { + groupvbox.NewButton("repoworld()", func() { repoworld() }) } diff --git a/globalResetOptions.go b/globalResetOptions.go index 2e753ba..99816e7 100644 --- a/globalResetOptions.go +++ b/globalResetOptions.go @@ -1,26 +1,25 @@ package main -import ( - "go.wit.com/log" +import ( "go.wit.com/gui/gui" + "go.wit.com/log" ) - func globalResetOptions(box *gui.Node) { group2 := box.NewGroup("Global Destructive Options") - buildOptions := group2.NewGrid("buildOptions",2, 1) + buildOptions := group2.NewGrid("buildOptions", 2, 1) buildOptions.NewLabel("global path reset") // to globally reset paths: // gofmt -w -r "go.wit.com/gui -> go.wit.com/gui/gui" . - buildOptions.NewButton("Find", func () { + buildOptions.NewButton("Find", func() { log.Warn("delete every repo marked PERFECT") var newCmds [][]string for _, repo := range allrepos { status := repo.getStatus() if status == "PERFECT" { var line []string - line = append(line, "rm", "-rf", "go/src/" + repo.path) + line = append(line, "rm", "-rf", "go/src/"+repo.path) newCmds = append(newCmds, line) } } @@ -30,14 +29,14 @@ func globalResetOptions(box *gui.Node) { }) buildOptions.NewLabel("delete PERFECT") - buildOptions.NewButton("Find", func () { + buildOptions.NewButton("Find", func() { log.Warn("delete every repo marked PERFECT") var newCmds [][]string for _, repo := range allrepos { status := repo.getStatus() if status == "PERFECT" { var line []string - line = append(line, "rm", "-rf", "go/src/" + repo.path) + line = append(line, "rm", "-rf", "go/src/"+repo.path) newCmds = append(newCmds, line) } } @@ -47,7 +46,7 @@ func globalResetOptions(box *gui.Node) { }) buildOptions.NewLabel("start over") - buildOptions.NewButton("rm ~/go/src & ~/go/pkg", func () { + buildOptions.NewButton("rm ~/go/src & ~/go/pkg", func() { var newCmds [][]string var dirty bool = false for _, repo := range allrepos { @@ -72,7 +71,7 @@ func globalResetOptions(box *gui.Node) { }) buildOptions.NewLabel("rebuild autotypist") - buildOptions.NewButton("go get", func () { + buildOptions.NewButton("go get", func() { var newCmds [][]string newCmds = append(newCmds, []string{"cd", "."}) newCmds = append(newCmds, []string{"mkdir", "-p", "go/src/go.wit.com/apps/"}) @@ -101,7 +100,7 @@ func globalResetOptions(box *gui.Node) { cmds = buildOptions.NewLabel("ls") buildOptions.NewLabel("--dry-run") - dryrun = buildOptions.NewButton("show commands", func () { + dryrun = buildOptions.NewButton("show commands", func() { if goMake("--dry-run") { log.Warn("EVERYTHING MIGHT HAVE WORKED") } else { @@ -111,7 +110,7 @@ func globalResetOptions(box *gui.Node) { }) buildOptions.NewLabel("Doit") - doit = buildOptions.NewButton("run commands", func () { + doit = buildOptions.NewButton("run commands", func() { doit.Disable() log.Warn("should run the commands here") // true here means dryrun == true. it's confusingly named diff --git a/main.go b/main.go index bdc67c2..a944ca8 100644 --- a/main.go +++ b/main.go @@ -1,15 +1,15 @@ // This is a simple example package main -import ( - "os/user" +import ( "embed" + "os/user" "go.wit.com/log" "go.wit.com/gui/gui" - "go.wit.com/gui/gadgets" - "go.wit.com/gui/lib/repostatus" + "go.wit.com/lib/gadgets" + "go.wit.com/lib/gui/repostatus" ) //go:embed resources/* @@ -51,7 +51,7 @@ func addRepo(grid *gui.Node, path string, master string, devel string, user stri newRepo.userVersion = grid.NewLabel("").SetProgName("userVersion") newRepo.dirtyLabel = grid.NewLabel("") - newRepo.showButton = grid.NewButton("Show()", func () { + newRepo.showButton = grid.NewButton("Show()", func() { if newRepo.status == nil { log.Warn("status window doesn't exist") return @@ -76,12 +76,12 @@ func addRepo(grid *gui.Node, path string, master string, devel string, user stri func autotypistWindow() { /* - me.autotypistWindow = gadgets.NewBasicWindow(myGui, "autotypist for GO & git. it types faster than you can.") - me.autotypistWindow.Make() - me.autotypistWindow.StandardExit() + me.autotypistWindow = gadgets.NewBasicWindow(myGui, "autotypist for GO & git. it types faster than you can.") + me.autotypistWindow.Make() + me.autotypistWindow.StandardExit() - box := me.autotypistWindow.Box() - me.autotypistWindow.Draw() + box := me.autotypistWindow.Box() + me.autotypistWindow.Draw() */ win := myGui.NewWindow("autotypist for GO & git. it types faster than you can.") box := win.NewBox("bw hbox", true) @@ -97,6 +97,8 @@ func repoworld() { reposwin.Make() reposbox = reposwin.Box().NewBox("bw vbox", false) + reposwin.Draw() + reposgroup = reposbox.NewGroup("go repositories (read from ~/.config/myrepolist)") reposgrid = reposgroup.NewGrid("test", 11, 1) @@ -116,11 +118,16 @@ func repoworld() { for _, line := range repos { log.Warn("repo =", line) path, mbranch, dbranch, ubranch := splitLine(line) - if mbranch == "" { mbranch = "master" } - if dbranch == "" { dbranch = "devel" } + if mbranch == "" { + mbranch = "master" + } + if dbranch == "" { + dbranch = "devel" + } usr, _ := user.Current() - if ubranch == "" { ubranch = usr.Username } + if ubranch == "" { + ubranch = usr.Username + } addRepo(reposgrid, path, mbranch, dbranch, ubranch) } - reposwin.Draw() } diff --git a/repolist.go b/repolist.go index ce3df89..49e9963 100644 --- a/repolist.go +++ b/repolist.go @@ -1,7 +1,7 @@ // This is a simple example package main -import ( +import ( "io/ioutil" "strings" ) diff --git a/scan.go b/scan.go index d78561e..d02b6f2 100644 --- a/scan.go +++ b/scan.go @@ -1,10 +1,10 @@ // This is a simple example package main -import ( +import ( "go.wit.com/log" - "go.wit.com/gui/lib/repostatus" + "go.wit.com/lib/gui/repostatus" ) func (r *repo) newScan() bool { diff --git a/structs.go b/structs.go index 7e163f3..ecbed45 100644 --- a/structs.go +++ b/structs.go @@ -1,10 +1,10 @@ // watch all your go git repos package main -import ( +import ( "go.wit.com/gui/gui" - "go.wit.com/gui/gadgets" - "go.wit.com/gui/lib/repostatus" + "go.wit.com/lib/gadgets" + "go.wit.com/lib/gui/repostatus" ) // the main window nodes @@ -32,9 +32,9 @@ type repoType struct { toMoveToBranch string // displays the preferred names used for the repo tree state - mainBranch *gadgets.BasicCombobox + mainBranch *gadgets.BasicCombobox develBranch *gadgets.BasicCombobox - userBranch *gadgets.BasicCombobox + userBranch *gadgets.BasicCombobox // #### autotypist Global Distructive & Reset Options // #### autotypist window end @@ -47,28 +47,28 @@ var dryrun *gui.Node var allrepos []*repo type repo struct { - hidden bool - path string + hidden bool + path string lasttagrev string - lasttag string + lasttag string // tags []string pLabel *gui.Node // path label // bLabel *gui.Node // branch label lastTag *gui.Node // last tagged version label - vLabel *gui.Node // version label + vLabel *gui.Node // version label // tagsDrop *gui.Node // list of all tags dirtyLabel *gui.Node // git state (dirty or not?) - masterName *gui.Node // the master branch name + masterName *gui.Node // the master branch name masterVersion *gui.Node // the master branch version - develName *gui.Node // the devel branch name - develVersion *gui.Node // the devel branch version - userName *gui.Node // the jcarr branch name - userVersion *gui.Node // the jcarr branch version + develName *gui.Node // the devel branch name + develVersion *gui.Node // the devel branch version + userName *gui.Node // the jcarr branch name + userVersion *gui.Node // the jcarr branch version - cButton *gui.Node // commit button - pButton *gui.Node // push button + cButton *gui.Node // commit button + pButton *gui.Node // push button showButton *gui.Node // the button! status *repostatus.RepoStatus diff --git a/unix.go b/unix.go index d045967..5574e5d 100644 --- a/unix.go +++ b/unix.go @@ -1,10 +1,10 @@ package main import ( - "strings" "go.wit.com/log" + "strings" - "go.wit.com/gui/lib/repostatus" + "go.wit.com/lib/gui/repostatus" ) var repopath string = "/home/jcarr/" @@ -18,9 +18,9 @@ func goMake(dryRun string) bool { continue } if line[0] == "cd" { - switch len(line) { + switch len(line) { case 1: - log.Verbose("do cmdPwd() to go root", repopath + "go/src") + log.Verbose("do cmdPwd() to go root", repopath+"go/src") workingPath = "" case 2: log.Verbose("do cmdPwd() here", line)