From b6373df5397e3818c8097f3f8119f140d417a32a Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 13 Nov 2024 12:08:58 -0600 Subject: [PATCH] more display fixes --- docs.go | 30 ------------------------------ globalBuildOptions.go | 5 +++-- globalDisplayOptions.go | 4 ++-- globalResetOptions.go | 30 ++++++++++++++++++++++++++++++ 4 files changed, 35 insertions(+), 34 deletions(-) diff --git a/docs.go b/docs.go index ec5a989..9e66ad8 100644 --- a/docs.go +++ b/docs.go @@ -1,46 +1,16 @@ package main import ( - "fmt" "os" "path/filepath" "go.wit.com/gui" - "go.wit.com/lib/gui/repolist" "go.wit.com/lib/gui/shell" - "go.wit.com/log" ) func docsBox(vbox *gui.Node) { group := vbox.NewGroup("Docs") - group.NewButton("make 'go.work' file", func() { - me.autotypistWindow.Disable() - - goSrcDir := me.goSrcPwd.String() - filename := filepath.Join(goSrcDir, "go.work") - - f, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE, 0600) - if err != nil { - return - } - defer f.Close() - fmt.Fprintln(f, "go 1.21.4") - fmt.Fprintln(f, "") - fmt.Fprintln(f, "use (") - for _, repo := range repolist.AllRepos() { - if repo.Status.Exists("go.mod") { - fmt.Fprintln(f, "\t"+repo.Status.GoPath()) - } else { - log.Info("missing go.mod for", repo.Status.Path()) - // repo.Status.MakeRedomod() - } - } - fmt.Fprintln(f, ")") - - me.autotypistWindow.Enable() - }) - group.NewButton("run pkgsite", func() { tmp := me.userHomePwd.String() tmpDir := filepath.Join(tmp, "go/src") diff --git a/globalBuildOptions.go b/globalBuildOptions.go index c6708be..2ae0326 100644 --- a/globalBuildOptions.go +++ b/globalBuildOptions.go @@ -114,7 +114,7 @@ func globalBuildOptions(vbox *gui.Node) { grid.NextRow() - grid.NewGroup("update from upstream") + grid.NewGroup("update all repos from upstream") grid.NextRow() grid.NewButton("git pull", func() { me.Disable() @@ -156,6 +156,8 @@ func globalBuildOptions(vbox *gui.Node) { }) grid.NextRow() + grid.NewGroup("build") + grid.NextRow() me.autoRebuildButton = grid.NewButton("rebuild autotypist", func() { me.autoRebuildButton.Disable() me.autoRebuildButton.SetLabel("running....") @@ -165,7 +167,6 @@ func globalBuildOptions(vbox *gui.Node) { }) grid.NextRow() - grid.NewButton("go build", func() { me.Disable() defer me.Enable() diff --git a/globalDisplayOptions.go b/globalDisplayOptions.go index 38d6431..68c7aef 100644 --- a/globalDisplayOptions.go +++ b/globalDisplayOptions.go @@ -56,9 +56,9 @@ func globalDisplayOptions(vbox *gui.Node) { os.Setenv("REPO_AUTO_SCAN", "true") scanbox.NewButton("scan now", func() { - log.Info("re-scanning repos now") + log.Info("re-scanning now") i, s := me.repos.View.ScanRepositories() - log.Info("re-scanning repos done", i, s) + log.Info("re-scanning done", i, "repos in", s) }) var tagsW *tagWindow diff --git a/globalResetOptions.go b/globalResetOptions.go index 4976ec3..cb326c2 100644 --- a/globalResetOptions.go +++ b/globalResetOptions.go @@ -1,12 +1,14 @@ package main import ( + "fmt" "os" "path/filepath" "strconv" "strings" "go.wit.com/gui" + "go.wit.com/lib/gui/repolist" "go.wit.com/log" ) @@ -15,6 +17,34 @@ func globalResetOptions(box *gui.Node) { grid := group2.RawGrid() + grid.NewButton("remake 'go.work' file", func() { + me.autotypistWindow.Disable() + + goSrcDir := me.goSrcPwd.String() + filename := filepath.Join(goSrcDir, "go.work") + + f, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE, 0600) + if err != nil { + return + } + defer f.Close() + fmt.Fprintln(f, "go 1.21.4") + fmt.Fprintln(f, "") + fmt.Fprintln(f, "use (") + for _, repo := range repolist.AllRepos() { + if repo.Status.Exists("go.mod") { + fmt.Fprintln(f, "\t"+repo.Status.GoPath()) + } else { + log.Info("missing go.mod for", repo.Status.Path()) + // repo.Status.MakeRedomod() + } + } + fmt.Fprintln(f, ")") + + me.autotypistWindow.Enable() + }) + grid.NextRow() + grid.NewButton("delete user branches", func() { os.Setenv("REPO_FORCE", "off") loop := me.repos.View.ReposSortByName()