From 01f93fe846d7e4ee7493fd2b1f7db3d3053c5518 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sat, 24 Feb 2024 11:54:47 -0600 Subject: [PATCH] play around with button options --- globalBuildOptions.go | 28 +++++++++++++++++++++++++--- globalResetOptions.go | 37 ++++++++++++++++++++++++++++++++++--- main.go | 1 - 3 files changed, 59 insertions(+), 7 deletions(-) diff --git a/globalBuildOptions.go b/globalBuildOptions.go index bff00b0..244dc4e 100644 --- a/globalBuildOptions.go +++ b/globalBuildOptions.go @@ -74,7 +74,31 @@ func globalBuildOptions(vbox *gui.Node) { me.userHomePwd.SetText(homeDir) srcDir := filepath.Join(homeDir, "go/src") me.goSrcPwd.SetText(srcDir) + grid.NextRow() + grid.NewGroup("git checkout") + // checking this will automatically make the branches off of devel + grid.NextRow() + me.autoCreateBranches = grid.NewCheckbox("create if missing").SetChecked(true) + grid.NextRow() + + grid.NewButton("default", func() { + me.repos.View.ArgCheckoutUser() + }) + grid.NewLabel("guimaster,master,main") // set the order of these in the config file + grid.NextRow() + + grid.NewButton("devel", func() { + me.repos.View.ArgCheckoutDevel() + }) + grid.NewLabel("guidevel,devel") + grid.NextRow() + + grid.NewButton("user", func() { + me.repos.View.ArgCheckoutUser() + }) + grid.NewLabel(usr.Username) + grid.NextRow() // select the branch you want to test, build and develop against // this lets you select your user branch, but, when you are happy // you can merge everything into the devel branch and make sure it actually @@ -119,14 +143,12 @@ func globalBuildOptions(vbox *gui.Node) { } log.Info("set", count, "branches to", targetName) }) - me.newBranch = grid.NewCombobox() + me.newBranch = grid.NewDropdown() me.newBranch.AddText("master") me.newBranch.AddText("devel") me.newBranch.AddText(usr.Username) me.newBranch.SetText(usr.Username) - // checking this will automatically make the branches off of devel - me.autoCreateBranches = grid.NewCheckbox("create if missing").SetChecked(true) grid.NextRow() } diff --git a/globalResetOptions.go b/globalResetOptions.go index d7027e7..0d1ea28 100644 --- a/globalResetOptions.go +++ b/globalResetOptions.go @@ -26,12 +26,43 @@ func globalResetOptions(box *gui.Node) { me.stopOnErrors.SetChecked(true) me.autoDryRun = group2.NewCheckbox("autotypist --dry-run") + me.autoDryRun.Custom = func() { + if me.autoDryRun.Checked() { + os.Setenv("REPO_DRYRUN", "on") + } else { + os.Setenv("REPO_DRYRUN", "off") + } + } + me.autoDryRun.SetChecked(true) - buildOptions := group2.NewGrid("buildOptions", 2, 1) + grid := group2.RawGrid() - buildOptions.NewLabel("start over") - me.deleteGoSrcPkgB = buildOptions.NewButton("rm ~/go/src & ~/go/pkg", func() { + grid.NewButton("delete user branches", func() { + os.Setenv("REPO_FORCE", "off") + for _, repo := range repolist.AllRepos() { + repo.Status.DeleteUserBranch(false) + } + }) + grid.NextRow() + + grid.NewButton("delete user branches --force", func() { + os.Setenv("REPO_FORCE", "on") + for _, repo := range repolist.AllRepos() { + repo.Status.DeleteUserBranch(true) + } + }) + grid.NextRow() + + grid.NewButton("reset all branches", func() { + for _, repo := range repolist.AllRepos() { + repo.Status.ResetBranches() + } + }) + grid.NextRow() + + grid.NewLabel("start over") + me.deleteGoSrcPkgB = grid.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" { diff --git a/main.go b/main.go index 9c9a9a8..ff5ad7c 100644 --- a/main.go +++ b/main.go @@ -62,6 +62,5 @@ func main() { // intermittently scans the status indefinitly me.repos.View.Watchdog(func() { log.Info("watchdog in autotypist main()") - log.Info("check for devel changes here") }) }