2024-01-16 04:46:17 -06:00
|
|
|
package main
|
|
|
|
|
2024-01-18 00:58:14 -06:00
|
|
|
import (
|
2024-01-30 17:22:46 -06:00
|
|
|
"path/filepath"
|
|
|
|
|
2024-01-18 05:03:04 -06:00
|
|
|
"go.wit.com/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("start over")
|
2024-01-25 11:35:40 -06:00
|
|
|
me.deleteGoSrcPkgB = buildOptions.NewButton("rm ~/go/src & ~/go/pkg", func() {
|
2024-01-24 22:22:34 -06:00
|
|
|
for _, repo := range me.allrepos {
|
2024-01-23 11:22:33 -06:00
|
|
|
// status := repo.getStatus()
|
2024-01-26 11:59:59 -06:00
|
|
|
if repo.checkDirty() {
|
2024-01-23 11:22:33 -06:00
|
|
|
log.Warn("repo is dirty. commit your changes first", repo.String())
|
2024-01-25 11:35:40 -06:00
|
|
|
me.deleteGoSrcPkgB.SetLabel("rm ~/go/src (can't. dirty repos)")
|
2024-01-23 11:22:33 -06:00
|
|
|
return
|
2024-01-16 04:46:17 -06:00
|
|
|
}
|
|
|
|
}
|
2024-01-25 11:38:12 -06:00
|
|
|
|
|
|
|
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?" {
|
2024-01-30 17:22:46 -06:00
|
|
|
homeDir := me.userHomePwd.String()
|
|
|
|
fullpath := filepath.Join(homeDir, "go")
|
|
|
|
gosrc := filepath.Join(fullpath, "src")
|
|
|
|
gopkg := filepath.Join(fullpath, "pkg")
|
|
|
|
quickCmd(fullpath, []string{"rm", "-rf", gosrc})
|
|
|
|
quickCmd(fullpath, []string{"chmod", "700", "-R", gopkg})
|
|
|
|
quickCmd(fullpath, []string{"rm", "-rf", gopkg})
|
2024-01-25 11:38:12 -06:00
|
|
|
}
|
2024-01-16 04:46:17 -06:00
|
|
|
})
|
|
|
|
}
|