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

@ -201,7 +201,7 @@ func repoAllButtons(box *gui.Node) {
grid1.NewButton("merge all user to devel", func() { grid1.NewButton("merge all user to devel", func() {
reposwin.Disable() reposwin.Disable()
if ! mergeAllUserToDevel() { if !mergeAllUserToDevel() {
return return
} }
reposwin.Enable() reposwin.Enable()
@ -209,7 +209,7 @@ func repoAllButtons(box *gui.Node) {
grid1.NewButton("merge all devel to main", func() { grid1.NewButton("merge all devel to main", func() {
reposwin.Disable() reposwin.Disable()
if ! mergeAllDevelToMain() { if !mergeAllDevelToMain() {
return return
} }
reposwin.Enable() reposwin.Enable()
@ -217,10 +217,10 @@ func repoAllButtons(box *gui.Node) {
grid1.NewButton("merge it all", func() { grid1.NewButton("merge it all", func() {
reposwin.Disable() reposwin.Disable()
if ! mergeAllUserToDevel() { if !mergeAllUserToDevel() {
return return
} }
if ! mergeAllDevelToMain() { if !mergeAllDevelToMain() {
return return
} }
reposwin.Enable() reposwin.Enable()
@ -265,31 +265,31 @@ func mergeAllDevelToMain() bool {
} }
func mergeAllUserToDevel() bool { func mergeAllUserToDevel() bool {
log.Info("merge all here") log.Info("merge all here")
for _, repo := range me.allrepos { for _, repo := range me.allrepos {
if repo.status.ReadOnly() { if repo.status.ReadOnly() {
log.Info("skipping readonly", repo.String(), repo.dirtyLabel.String()) log.Info("skipping readonly", repo.String(), repo.dirtyLabel.String())
continue continue
}
if repo.dirtyLabel.String() != "merge to devel" {
log.Info("skipping. not merge to devel", repo.String(), repo.dirtyLabel.String())
continue
}
if repo.status.CheckDirty() {
log.Info("skipping dirty", repo.String(), repo.dirtyLabel.String())
continue
}
log.Info("found", repo.String(), repo.dirtyLabel.String())
// repo.status.Update()
if repo.status.RunDevelMergeB() {
log.Warn("THINGS SEEM OK fullAutomation() returned true.")
} else {
log.Warn("THINGS FAILED fullAutomation() returned false")
return false
}
repo.status.Update()
repo.newScan()
} }
log.Warn("EVERYTHING WORKED") if repo.dirtyLabel.String() != "merge to devel" {
return true log.Info("skipping. not merge to devel", repo.String(), repo.dirtyLabel.String())
continue
}
if repo.status.CheckDirty() {
log.Info("skipping dirty", repo.String(), repo.dirtyLabel.String())
continue
}
log.Info("found", repo.String(), repo.dirtyLabel.String())
// repo.status.Update()
if repo.status.RunDevelMergeB() {
log.Warn("THINGS SEEM OK fullAutomation() returned true.")
} else {
log.Warn("THINGS FAILED fullAutomation() returned false")
return false
}
repo.status.Update()
repo.newScan()
}
log.Warn("EVERYTHING WORKED")
return true
} }

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