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