add the dangerous things

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-31 01:36:54 -06:00
parent f419286c05
commit 1c32636383
5 changed files with 69 additions and 46 deletions

View File

@ -56,7 +56,7 @@ func CheckReady() bool {
}
testf = filepath.Join(fullpath, "LICENSE")
if ! Exists(testf) {
if !Exists(testf) {
log.Info("\trepo is not ready. missing LICENSE")
return false
}

View File

@ -5,6 +5,7 @@ import (
"go.wit.com/gui"
"go.wit.com/lib/debugger"
"go.wit.com/lib/gui/logsettings"
"go.wit.com/log"
// "go.wit.com/gui/gadgets"
)
@ -69,23 +70,16 @@ func globalDisplayOptions(box *gui.Node) {
globalDisplayShow()
}
}
me.ignoreWhitelist = group1.NewCheckbox("ignore whitelist (are you sure?)").SetChecked(false)
me.scanEveryMinute = group1.NewCheckbox("Scan every minute").SetChecked(false)
/*
group1.NewButton("status.Update() all", func() {
for _, repo := range me.allrepos {
repo.status.Update()
}
})
group1.NewButton("rescan all", func() {
for _, repo := range me.allrepos {
repo.newScan()
}
})
*/
group1.NewButton("set all branches to master", func() {
for _, repo := range me.allrepos {
if whitelist(repo.String()) {
continue
}
if repo.status.CheckoutMaster() {
log.Warn("set master branch worked", repo.String)
repo.newScan()
@ -96,6 +90,24 @@ func globalDisplayOptions(box *gui.Node) {
}
})
group1.NewButton("rm -f go.mod go.sum", func() {
for _, repo := range me.allrepos {
if whitelist(repo.String()) {
continue
}
repo.status.RunCmd([]string{"rm", "-f", "go.mod", "go.sum"})
}
})
group1.NewButton("git reset --hard", func() {
for _, repo := range me.allrepos {
if whitelist(repo.String()) {
continue
}
repo.status.RunCmd([]string{"git", "reset", "--hard"})
}
})
group2 := vbox.NewGroup("Debugger")
group2.NewButton("logging Window", func() {
logsettings.LogWindow()

View File

@ -40,7 +40,7 @@ type releaseStruct struct {
makeRedomodB *gui.Node
sendVersionB *gui.Node
checkSafeB *gui.Node
whitelist map[string]*repo
whitelist map[string]*repo
}
func (w *autoType) Disable() {
@ -51,17 +51,6 @@ func (w *autoType) Enable() {
w.mainWindow.Enable()
}
func whitelist(path string) bool {
// log.Info("whitelist START", path)
_, ok := release.whitelist[path]
if ok {
// log.Info("whitelist ok == true", path)
return true
}
// log.Info("whitelist ok == false", path)
return false
}
func createReleaseBox(box *gui.Node) {
release.versionS = "0.17.0"
release.reasonS = "gocui"
@ -361,30 +350,15 @@ func setCurrentRepo(newcur *repo, s string, note string) bool {
release.openrepo.Enable()
/*
if newcur.status.ReadOnly() {
release.readOnly.SetValue("true ro")
} else {
release.readOnly.SetValue("false ro")
}
if newcur.status.ReadOnly() {
release.readOnly.SetValue("true ro")
} else {
release.readOnly.SetValue("false ro")
}
*/
return true
}
func initWhitelist() {
release.whitelist = make(map[string]*repo)
for _, repo := range me.allrepos {
if strings.HasPrefix(repo.String(), "go.wit.com/dev/") {
release.whitelist[repo.String()] = repo
}
if repo.String() == "go.wit.com/apps/guireleaser" {
release.whitelist[repo.String()] = repo
}
if repo.String() == "go.wit.com/lib/gui/repostatus" {
release.whitelist[repo.String()] = repo
}
}
}
func scanForReady() bool {
for _, repo := range me.allrepos {
goSumS := repo.getGoSumStatus()

View File

@ -26,6 +26,7 @@ type autoType struct {
// #### autotypist Global Display Options
autoHidePerfect *gui.Node
autoHideReadOnly *gui.Node
ignoreWhitelist *gui.Node
// #### autotypist Global Build Options
// what to change all the branches to

36
whitelist.go Normal file
View File

@ -0,0 +1,36 @@
// This is a simple example
package main
import (
"strings"
)
func initWhitelist() {
release.whitelist = make(map[string]*repo)
for _, repo := range me.allrepos {
if strings.HasPrefix(repo.String(), "go.wit.com/dev/") {
release.whitelist[repo.String()] = repo
}
if repo.String() == "go.wit.com/apps/guireleaser" {
release.whitelist[repo.String()] = repo
}
if repo.String() == "go.wit.com/lib/gui/repostatus" {
release.whitelist[repo.String()] = repo
}
}
}
func whitelist(path string) bool {
// log.Info("whitelist START", path)
if me.ignoreWhitelist.Checked() {
return true
}
_, ok := release.whitelist[path]
if ok {
// log.Info("whitelist ok == true", path)
return true
}
// log.Info("whitelist ok == false", path)
return false
}