2024-01-16 04:46:17 -06:00
|
|
|
package main
|
|
|
|
|
2024-01-18 00:58:14 -06:00
|
|
|
import (
|
2024-01-16 04:46:17 -06:00
|
|
|
"go.wit.com/gui/gui"
|
2024-01-18 00:58:14 -06:00
|
|
|
"go.wit.com/log"
|
2024-01-16 04:46:17 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
func globalResetOptions(box *gui.Node) {
|
2024-01-16 11:56:55 -06:00
|
|
|
group2 := box.NewGroup("Global Destructive Options")
|
2024-01-18 00:58:14 -06:00
|
|
|
buildOptions := group2.NewGrid("buildOptions", 2, 1)
|
2024-01-16 04:46:17 -06:00
|
|
|
|
|
|
|
buildOptions.NewLabel("global path reset")
|
|
|
|
// to globally reset paths:
|
|
|
|
// gofmt -w -r "go.wit.com/gui -> go.wit.com/gui/gui" .
|
2024-01-18 00:58:14 -06:00
|
|
|
buildOptions.NewButton("Find", func() {
|
2024-01-16 04:46:17 -06:00
|
|
|
log.Warn("delete every repo marked PERFECT")
|
|
|
|
var newCmds [][]string
|
|
|
|
for _, repo := range allrepos {
|
|
|
|
status := repo.getStatus()
|
|
|
|
if status == "PERFECT" {
|
|
|
|
var line []string
|
2024-01-18 00:58:14 -06:00
|
|
|
line = append(line, "rm", "-rf", "go/src/"+repo.path)
|
2024-01-16 04:46:17 -06:00
|
|
|
newCmds = append(newCmds, line)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
me.script = newCmds
|
|
|
|
doit.Enable()
|
|
|
|
setGitCommands()
|
|
|
|
})
|
|
|
|
|
|
|
|
buildOptions.NewLabel("delete PERFECT")
|
2024-01-18 00:58:14 -06:00
|
|
|
buildOptions.NewButton("Find", func() {
|
2024-01-16 04:46:17 -06:00
|
|
|
log.Warn("delete every repo marked PERFECT")
|
|
|
|
var newCmds [][]string
|
|
|
|
for _, repo := range allrepos {
|
|
|
|
status := repo.getStatus()
|
|
|
|
if status == "PERFECT" {
|
|
|
|
var line []string
|
2024-01-18 00:58:14 -06:00
|
|
|
line = append(line, "rm", "-rf", "go/src/"+repo.path)
|
2024-01-16 04:46:17 -06:00
|
|
|
newCmds = append(newCmds, line)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
me.script = newCmds
|
|
|
|
doit.Enable()
|
|
|
|
setGitCommands()
|
|
|
|
})
|
|
|
|
|
|
|
|
buildOptions.NewLabel("start over")
|
2024-01-18 00:58:14 -06:00
|
|
|
buildOptions.NewButton("rm ~/go/src & ~/go/pkg", func() {
|
2024-01-16 04:46:17 -06:00
|
|
|
var newCmds [][]string
|
|
|
|
var dirty bool = false
|
|
|
|
for _, repo := range allrepos {
|
|
|
|
status := repo.getStatus()
|
|
|
|
if status == "dirty" {
|
|
|
|
dirty = true
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
newCmds = append(newCmds, []string{"cd", "."})
|
|
|
|
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/"})
|
|
|
|
if dirty {
|
|
|
|
newCmds = append(newCmds, []string{"can't do this with dirty repos"})
|
|
|
|
doit.Disable()
|
|
|
|
} else {
|
|
|
|
doit.Enable()
|
|
|
|
}
|
|
|
|
me.script = newCmds
|
|
|
|
setGitCommands()
|
|
|
|
})
|
|
|
|
|
|
|
|
buildOptions.NewLabel("rebuild autotypist")
|
2024-01-18 00:58:14 -06:00
|
|
|
buildOptions.NewButton("go get", func() {
|
2024-01-16 04:46:17 -06:00
|
|
|
var newCmds [][]string
|
|
|
|
newCmds = append(newCmds, []string{"cd", "."})
|
|
|
|
newCmds = append(newCmds, []string{"mkdir", "-p", "go/src/go.wit.com/apps/"})
|
|
|
|
newCmds = append(newCmds, []string{"cd", "go/src/go.wit.com/apps/"})
|
|
|
|
newCmds = append(newCmds, []string{"go", "get", "-v", "-u", "go.wit.com/apps/myrepos"})
|
|
|
|
newCmds = append(newCmds, []string{"cd", "go/src/go.wit.com/apps/myrepos"})
|
|
|
|
newCmds = append(newCmds, []string{"go", "get", "-v", "-u", "."})
|
|
|
|
newCmds = append(newCmds, []string{"go", "get", "-v", "go.wit.com/gui/toolkits"})
|
|
|
|
newCmds = append(newCmds, []string{"cd", "go/src/go.wit.com/gui/toolkits/andlabs"})
|
|
|
|
newCmds = append(newCmds, []string{"go", "get", "-v", "-u", "."})
|
|
|
|
newCmds = append(newCmds, []string{"cd", "go/src/go.wit.com/gui/toolkits/gocui"})
|
|
|
|
newCmds = append(newCmds, []string{"go", "get", "-v", "-u", "."})
|
|
|
|
newCmds = append(newCmds, []string{"cd", "go/src/go.wit.com/gui/toolkits"})
|
|
|
|
newCmds = append(newCmds, []string{"make"})
|
|
|
|
newCmds = append(newCmds, []string{"cd", "go/src/go.wit.com/apps/myrepos"})
|
|
|
|
newCmds = append(newCmds, []string{"make"})
|
|
|
|
me.script = newCmds
|
|
|
|
setGitCommands()
|
|
|
|
doit.Enable()
|
|
|
|
})
|
|
|
|
|
|
|
|
buildOptions.NewSeparator("endStatusScans")
|
|
|
|
buildOptions.NewSeparator("endStatusScans")
|
|
|
|
|
|
|
|
buildOptions.NewLabel("cmd")
|
|
|
|
cmds = buildOptions.NewLabel("ls")
|
|
|
|
|
|
|
|
buildOptions.NewLabel("--dry-run")
|
2024-01-18 00:58:14 -06:00
|
|
|
dryrun = buildOptions.NewButton("show commands", func() {
|
2024-01-16 04:46:17 -06:00
|
|
|
if goMake("--dry-run") {
|
|
|
|
log.Warn("EVERYTHING MIGHT HAVE WORKED")
|
|
|
|
} else {
|
|
|
|
log.Warn("EVERYTHING WILL NOT WORK")
|
|
|
|
dryrun.Disable()
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
buildOptions.NewLabel("Doit")
|
2024-01-18 00:58:14 -06:00
|
|
|
doit = buildOptions.NewButton("run commands", func() {
|
2024-01-16 04:46:17 -06:00
|
|
|
doit.Disable()
|
|
|
|
log.Warn("should run the commands here")
|
|
|
|
// true here means dryrun == true. it's confusingly named
|
|
|
|
if goMake("--doit") {
|
|
|
|
log.Warn("EVERYTHING WORKED")
|
|
|
|
} else {
|
|
|
|
log.Warn("EVERYTHING DID NOT WORK")
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|