forge/main.go

89 lines
1.7 KiB
Go
Raw Normal View History

package main
// An app to submit patches for the 30 GO GUI repos
import (
2024-12-02 06:59:56 -06:00
"os"
"go.wit.com/dev/alexflint/arg"
"go.wit.com/lib/gadgets"
2024-12-02 06:59:56 -06:00
"go.wit.com/lib/protobuf/forgepb"
"go.wit.com/log"
"go.wit.com/gui"
)
2024-12-02 06:59:56 -06:00
// sent via -ldflags
var VERSION string
var BUILDTIME string
func main() {
me = new(mainType)
2024-12-02 06:59:56 -06:00
me.pp = arg.MustParse(&argv)
// load the ~/.config/forge/ config
me.forge = forgepb.Init()
os.Setenv("REPO_WORK_PATH", me.forge.GetGoSrc())
2024-12-04 15:35:48 -06:00
// show your forge config settings
if argv.ListConf {
me.forge.ConfigPrintTable()
os.Exit(0)
}
2024-12-02 06:59:56 -06:00
// processes any --list like options
// may exit
list()
2024-12-03 00:33:17 -06:00
scan()
2024-12-02 08:44:58 -06:00
if argv.RedoGoMod {
2024-12-03 13:23:12 -06:00
me.forge.RillRedoGoMod()
os.Exit(0)
2024-12-02 08:44:58 -06:00
repos := me.forge.Repos.SortByGoPath()
for repos.Scan() {
repo := repos.Next()
if !repo.IsValid() {
log.Printf("%10s %-50s", "old?", repo.GetGoPath())
continue
}
2024-12-03 13:23:12 -06:00
log.Printf("running on: %-50s", repo.GetGoPath())
if argv.Erase {
repo.EraseGoMod()
} else {
repo.RedoGoMod()
2024-12-02 08:44:58 -06:00
}
}
}
2024-12-04 15:35:48 -06:00
me.pp.WriteHelp(os.Stdout)
2024-12-03 13:23:12 -06:00
os.Exit(0)
2024-12-02 08:44:58 -06:00
2024-12-02 06:59:56 -06:00
me.myGui = gui.New()
me.myGui.Default()
me.mainWindow = gadgets.RawBasicWindow("submit & test patchsets")
me.mainWindow.Make()
me.mainWindow.Show()
me.mainbox = me.mainWindow.Box()
2024-02-13 16:18:37 -06:00
// disable the interface while everything is scanned
me.Disable()
2024-02-13 16:18:37 -06:00
vbox2 := me.mainbox.NewVerticalBox("BOX2")
globalBuildOptions(vbox2)
me.summary = submitPatchesBox(vbox2)
2024-02-17 14:20:37 -06:00
me.repos = makeRepoView()
2024-02-17 08:38:44 -06:00
2024-02-14 13:43:43 -06:00
// processing is done. update the repo summary box
me.summary.Update()
2024-02-18 07:24:56 -06:00
me.Enable()
2024-02-17 08:38:44 -06:00
// intermittently scans the status indefinitly
2024-02-18 07:24:56 -06:00
me.repos.View.Watchdog(func() {
log.Info("In main()")
// processing is done. update the repo summary box
me.summary.Update()
})
}