summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-16 02:01:34 -0600
committerJeff Carr <[email protected]>2024-01-16 02:01:34 -0600
commit6b8e51a7421dd42a34813af7b9933ee6a97003d5 (patch)
treedbdb125a748eb68d2848af958404aeb0d0dc91cb /main.go
parent46dbb77317ac68d98c8ae28b5725eb78d3db6071 (diff)
attempt to go get everything in the config file
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'main.go')
-rw-r--r--main.go105
1 files changed, 85 insertions, 20 deletions
diff --git a/main.go b/main.go
index dff4d4c..5cff189 100644
--- a/main.go
+++ b/main.go
@@ -2,6 +2,7 @@
package main
import (
+ "os"
"os/user"
"embed"
@@ -91,6 +92,68 @@ func addRepo(grid *gui.Node, path string, master string, devel string, user stri
allrepos = append(allrepos, newRepo)
}
+// just returns if something exists at the path name (file, directory, whatever)
+func doesExist(path string) bool {
+ if _, err := os.Stat(path); err != nil {
+ if os.IsNotExist(err) {
+ return false
+ }
+ }
+ return true
+}
+
+func globalBuildOptions(box *gui.Node) {
+ var setCurrentBranch *gui.Node
+ group1 := box.NewGroup("Global Build Options")
+ groupvbox := group1.NewBox("bw vbox", false)
+ grouphbox := groupvbox.NewBox("bw hbox", true)
+ guiBranch := gadgets.NewBasicCombobox(grouphbox, "Select GUI branch")
+ guiBranch.Add("guimaster")
+ guiBranch.Add("guidevel")
+ guiBranch.Add("jcarr")
+ guiBranch.Custom = func () {
+ tmp := "set all current branchs to " + guiBranch.Get()
+ setCurrentBranch.Set(tmp)
+ }
+
+ setCurrentBranch = groupvbox.NewButton("set current branch to", func () {
+ for _, repo := range allrepos {
+ repo.status.Update()
+ }
+ })
+ groupvbox.NewButton("go get everything in configfile", func () {
+ var newCmds [][]string
+ // usr, _ := user.Current()
+ newCmds = append(newCmds, []string{"cd", "go/src/gui/app/myrepos"})
+ repos := myrepolist()
+ for _, line := range repos {
+ log.Warn("repo =", line)
+ path, _, _, _ := splitLine(line)
+ if doesExist("/home/jcarr/go/src/" + path) {
+ continue
+ }
+ newCmds = append(newCmds, []string{"go", "get", "-v", path})
+ }
+
+ script = newCmds
+ doit.Enable()
+ setGitCommands()
+ })
+
+ groupvbox.NewButton("status.Update() all", func () {
+ for _, repo := range allrepos {
+ repo.status.Update()
+ }
+ })
+
+ groupvbox.NewButton("rescan all", func () {
+ for _, repo := range allrepos {
+ repo.newScan()
+ }
+ })
+}
+
+
// This creates a window
func repoworld() {
reposwin = gadgets.NewBasicWindow(myGui, "autotypist for GO & git. it types faster than you can.")
@@ -126,17 +189,30 @@ func repoworld() {
box2 := reposwin.Box().NewBox("bw vbox", false)
- buildOptions := box2.NewGrid("buildOptions",2, 1)
- title := gadgets.NewOneLiner(buildOptions, "Branch and build")
- title.Set("options")
- guiBranch := gadgets.NewBasicCombobox(buildOptions, "Select GUI branch")
- guiBranch.Add("guimaster")
- guiBranch.Add("guidevel")
- guiBranch.Add("jcarr")
+ globalBuildOptions(box2)
// gofmt -w -r "go.wit.com/gui -> go.wit.com/gui/gui" .
+ group2 := box2.NewGroup("Global Reset Options")
+ buildOptions := group2.NewGrid("buildOptions",2, 1)
- buildOptions.NewLabel("only PERFECT")
+ buildOptions.NewLabel("delete PERFECT")
+ 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)
+ newCmds = append(newCmds, line)
+ }
+ }
+ script = newCmds
+ doit.Enable()
+ setGitCommands()
+ })
+
+ buildOptions.NewLabel("delete PERFECT")
buildOptions.NewButton("Find", func () {
log.Warn("delete every repo marked PERFECT")
var newCmds [][]string
@@ -178,7 +254,7 @@ func repoworld() {
setGitCommands()
})
- buildOptions.NewLabel("get autotypist")
+ buildOptions.NewLabel("rebuild autotypist")
buildOptions.NewButton("go get", func () {
var newCmds [][]string
newCmds = append(newCmds, []string{"cd", "."})
@@ -201,17 +277,6 @@ func repoworld() {
doit.Enable()
})
- buildOptions.NewButton("status.Update() all", func () {
- for _, repo := range allrepos {
- repo.status.Update()
- }
- })
-
- buildOptions.NewButton("rescan all", func () {
- for _, repo := range allrepos {
- repo.newScan()
- }
- })
buildOptions.NewSeparator("endStatusScans")
buildOptions.NewSeparator("endStatusScans")