code reorg

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-30 13:45:42 -06:00
parent b414d5ed4b
commit 37f59a9e48
4 changed files with 9 additions and 139 deletions

View File

@ -110,7 +110,7 @@ func globalDisplayOptions(box *gui.Node) {
}
}
me.autoHidePerfect = group1.NewCheckbox("Hide Perfectly clean repos").SetChecked(false)
me.autoHidePerfect = group1.NewCheckbox("Hide Perfectly clean repos").SetChecked(true)
me.autoHidePerfect.Custom = func() {
if me.autoHidePerfect.Checked() {
globalDisplaySetRepoState()

View File

@ -1,33 +0,0 @@
package main
import (
"go.wit.com/gui"
"go.wit.com/log"
)
func globalResetOptions(box *gui.Node) {
group2 := box.NewGroup("Global Destructive Options")
buildOptions := group2.NewGrid("buildOptions", 2, 1)
buildOptions.NewLabel("start over")
me.deleteGoSrcPkgB = buildOptions.NewButton("rm ~/go/src & ~/go/pkg", func() {
for _, repo := range me.allrepos {
// status := repo.getStatus()
if repo.checkDirty() {
log.Warn("repo is dirty. commit your changes first", repo.String())
me.deleteGoSrcPkgB.SetLabel("rm ~/go/src (can't. dirty repos)")
return
}
}
log.Warn("no repos have uncommited changes")
log.Warn("TODO: check things are pushed and check every dir in go/src/")
me.deleteGoSrcPkgB.SetLabel("ARE YOU SURE?")
if me.deleteGoSrcPkgB.String() == "ARE YOU SURE?" {
fullpath := "/home/jcarr/go/"
quickCmd(fullpath, []string{"rm", "-rf", "/home/jcarr/go/src/"})
quickCmd(fullpath, []string{"chmod", "700", "-R", "/home/jcarr/go/pkg/"})
quickCmd(fullpath, []string{"rm", "-rf", "/home/jcarr/go/pkg/"})
}
})
}

View File

@ -1,101 +0,0 @@
package main
import (
"os"
"go.wit.com/lib/gui/repostatus"
"go.wit.com/gui"
)
// things being testing
func globalTestingOptions(box *gui.Node) {
test1 := box.NewGroup("testing build")
me.autoRebuildButton = test1.NewButton("rebuild autotypist", func() {
me.autoRebuildButton.Disable()
me.autoRebuildButton.SetLabel("running....")
attemptAutoRebuild()
me.autoRebuildButton.Enable()
me.autoRebuildButton.SetLabel("rebuild autotypist")
})
/*
me.downloadEverythingButton = test1.NewButton("go get go.wit.com", func() {
me.downloadEverythingButton.Disable()
me.autoWorkingPwd.SetValue("/home/jcarr/go/src")
var perfect bool = true
repos := myrepolist()
for _, line := range repos {
log.Verbose("repo =", line)
path, _, _, _ := splitLine(line)
path = strings.TrimSpace(path)
if path == "#" {
// skip comment lines
continue
}
if doesExist("/home/jcarr/go/src/" + path) {
continue
}
// attempt to download it
quickCmd("/home/jcarr/go/src/go.wit.com", []string{"go", "get", "-v", path})
perfect = false
}
if perfect {
var notes string
notes = "you have already downloaded\neverything on go.wit.com"
me.autoWorkingPwd.SetValue(notes)
me.downloadEverythingButton.Disable()
return
} else {
var notes string
notes = "download everything failed"
me.autoWorkingPwd.SetValue(notes)
me.downloadEverythingButton.Enable()
}
})
*/
var listallB *gui.Node
listallB = test1.NewButton("go.wit.com/list", func() {
listallB.Disable()
listWindow()
listallB.Enable()
})
test1.NewButton("repostatus.ListAll()", func() {
repostatus.ListAll()
})
test1.NewButton("repostatus.ScanGoSrc()", func() {
repostatus.ScanGoSrc()
})
}
func attemptAutoRebuild() {
os.Setenv("GO111MODULE", "off")
fullpath := "/home/jcarr/go/"
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", "-v", "go.wit.com/apps/autotypist"})
quickCmd(fullpath, []string{"go", "get", "-v", "go.wit.com/toolkits/debian"})
quickCmd(fullpath, []string{"go", "get", "-v", "go.wit.com/toolkits/tree"})
quickCmd(fullpath, []string{"go", "get", "-v", "go.wit.com/toolkits/nocui"})
quickCmd(fullpath, []string{"go", "get", "-v", "go.wit.com/toolkits/gocui"})
quickCmd(fullpath, []string{"go", "get", "-v", "go.wit.com/toolkits/andlabs"})
fullpath = "/home/jcarr/go/src/go.wit.com/toolkits/nocui/"
quickCmd(fullpath, []string{"go", "get", "-v", "-u", "."})
quickCmd(fullpath, []string{"go", "build", "-v", "-x", "-buildmode=plugin", "-o", "../nocui.so"})
fullpath = "/home/jcarr/go/src/go.wit.com/toolkits/gocui/"
quickCmd(fullpath, []string{"go", "get", "-v", "-u", "."})
quickCmd(fullpath, []string{"go", "build", "-v", "-x", "-buildmode=plugin", "-o", "../gocui.so"})
fullpath = "/home/jcarr/go/src/go.wit.com/toolkits/andlabs/"
quickCmd(fullpath, []string{"go", "get", "-v", "-u", "."})
quickCmd(fullpath, []string{"go", "build", "-v", "-x", "-buildmode=plugin", "-o", "../andlabs.so"})
fullpath = "/home/jcarr/go/src/go.wit.com/apps/autotypist"
quickCmd(fullpath, []string{"go", "get", "-v", "-u", "."})
quickCmd(fullpath, []string{"go", "build", "-v", "-x"})
}

12
main.go
View File

@ -30,6 +30,11 @@ func main() {
autotypistWindow()
repoworld()
for _, repo := range me.allrepos {
repo.status.Update()
repo.newScan()
}
// scan repos every 30 seconds
// check every second for the checkbox changing
var i int = 60
@ -126,10 +131,9 @@ func autotypistWindow() {
box := win.NewBox("bw hbox", true)
globalDisplayOptions(box)
globalBuildOptions(box)
globalTestingOptions(box)
globalResetOptions(box)
// globalBuildOptions(box)
// globalTestingOptions(box)
// globalResetOptions(box)
}
// This creates a window