more display fixes

This commit is contained in:
Jeff Carr 2024-11-13 12:08:58 -06:00
parent 967fc70a48
commit b6373df539
4 changed files with 35 additions and 34 deletions

30
docs.go
View File

@ -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")

View File

@ -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()

View File

@ -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

View File

@ -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()