playing around

This commit is contained in:
Jeff Carr 2024-02-20 21:03:50 -06:00
parent 5f8cce4e3b
commit 42c506c098
2 changed files with 18 additions and 5 deletions

View File

@ -3,6 +3,7 @@ package main
import (
"os"
"path/filepath"
"strings"
"go.wit.com/gui"
"go.wit.com/lib/gui/repolist"
@ -30,7 +31,11 @@ func globalResetOptions(box *gui.Node) {
buildOptions.NewLabel("start over")
me.deleteGoSrcPkgB = buildOptions.NewButton("rm ~/go/src & ~/go/pkg", func() {
var state string = me.deleteGoSrcPkgB.String()
for _, repo := range repolist.AllRepos() {
if repo.GoPath() == "go.wit.com/apps/autotypist" {
continue
}
if repo.Status.CheckDirty() {
log.Warn("repo is dirty. commit your changes first", repo.Status.Path())
me.deleteGoSrcPkgB.SetLabel("rm ~/go/src (can't. dirty repos)")
@ -40,12 +45,16 @@ func globalResetOptions(box *gui.Node) {
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 strings.HasPrefix(state, "rm ~/go/src") {
me.deleteGoSrcPkgB.SetLabel("ARE YOU SURE?")
return
}
if me.deleteGoSrcPkgB.String() == "ARE YOU SURE?" {
me.deleteGoSrcPkgB.SetLabel("WE ARE NOT KIDDING")
return
}
var totals string = "All " + me.summary.totalGoOL.String() + " Repos?"
log.Info("totals =", totals)
if me.deleteGoSrcPkgB.String() == "WE ARE NOT KIDDING" {
me.deleteGoSrcPkgB.SetLabel(totals)
return
@ -58,6 +67,10 @@ func globalResetOptions(box *gui.Node) {
quickCmd(fullpath, []string{"rm", "-rf", gosrc})
quickCmd(fullpath, []string{"chmod", "700", "-R", gopkg})
quickCmd(fullpath, []string{"rm", "-rf", gopkg})
if me.autoDryRun.Checked() {
me.deleteGoSrcPkgB.SetLabel("rm ~/go/src (uncheck dry-run)")
return
}
}
})
}

View File

@ -88,10 +88,10 @@ func submitPatchesBox(box *gui.Node) *patchSummary {
// this Update is deprecated and probably should be the function above
/*
s.grid.NewButton("summary.Update()", func() {
// update the stats
s.Update()
})
s.grid.NewButton("summary.Update()", func() {
// update the stats
s.Update()
})
*/
s.grid.NewButton("Make Patches", func() {