go.work file for pkgsite

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-02-06 04:03:17 -06:00
parent 7071aad1a5
commit fb88285aeb
4 changed files with 62 additions and 33 deletions

View File

@ -2,9 +2,14 @@
package main package main
import ( import (
"fmt"
"os"
"path/filepath"
"go.wit.com/gui" "go.wit.com/gui"
"go.wit.com/lib/debugger" "go.wit.com/lib/debugger"
"go.wit.com/lib/gui/logsettings" "go.wit.com/lib/gui/logsettings"
"go.wit.com/log"
// "go.wit.com/gui/gadgets" // "go.wit.com/gui/gadgets"
) )
@ -71,6 +76,30 @@ func globalDisplayOptions(box *gui.Node) {
} }
me.scanEveryMinute = group1.NewCheckbox("Scan every minute").SetChecked(false) me.scanEveryMinute = group1.NewCheckbox("Scan every minute").SetChecked(false)
group1.NewButton("make go.work file", func() {
me.autotypistWindow.Disable()
defer me.autotypistWindow.Enable()
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 me.allrepos {
if repo.status.Exists("go.mod") {
fmt.Fprintln(f, "\t"+repo.String())
} else {
log.Info("missing go.mod for", repo.String())
repo.status.MakeRedomod()
}
}
fmt.Fprintln(f, ")")
})
group2 := vbox.NewGroup("Debugger") group2 := vbox.NewGroup("Debugger")
group2.NewButton("logging Window", func() { group2.NewButton("logging Window", func() {
logsettings.LogWindow() logsettings.LogWindow()

View File

@ -63,8 +63,8 @@ func main() {
} }
func autotypistWindow() { func autotypistWindow() {
win := me.myGui.NewWindow("autotypist for GO & git. it types faster than you can.") me.autotypistWindow = me.myGui.NewWindow("autotypist for GO & git. it types faster than you can.")
box := win.NewBox("bw hbox", true) box := me.autotypistWindow.NewBox("bw hbox", true)
globalDisplayOptions(box) globalDisplayOptions(box)
globalBuildOptions(box) globalBuildOptions(box)

View File

@ -19,7 +19,7 @@ type autoType struct {
allrepos map[string]*repo allrepos map[string]*repo
myGui *gui.Node myGui *gui.Node
autotypistWindow *gadgets.BasicWindow autotypistWindow *gui.Node
// #### autotypist Global Display Options // #### autotypist Global Display Options
autoHidePerfect *gui.Node autoHidePerfect *gui.Node