forge/main.go

80 lines
1.5 KiB
Go

package main
// An app to submit patches for the 30 GO GUI repos
import (
"os"
"go.wit.com/dev/alexflint/arg"
"go.wit.com/lib/gadgets"
"go.wit.com/lib/protobuf/forgepb"
"go.wit.com/log"
"go.wit.com/gui"
)
// sent via -ldflags
var VERSION string
var BUILDTIME string
func main() {
me = new(mainType)
me.pp = arg.MustParse(&argv)
// load the ~/.config/forge/ config
me.forge = forgepb.Init()
os.Setenv("REPO_WORK_PATH", me.forge.GetGoSrc())
// processes any --list like options
// may exit
list()
scan()
os.Exit(0)
if argv.RedoGoMod {
repos := me.forge.Repos.SortByGoPath()
for repos.Scan() {
repo := repos.Next()
if !repo.IsValid() {
log.Printf("%10s %-50s", "old?", repo.GetGoPath())
continue
}
if me.forge.IsReadOnly(repo.GetGoPath()) {
log.Printf("%10s %-50s", "readonly", repo.GetGoPath())
continue
}
repo.RedoGoMod()
}
os.Exit(0)
}
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()
// disable the interface while everything is scanned
me.Disable()
vbox2 := me.mainbox.NewVerticalBox("BOX2")
globalBuildOptions(vbox2)
me.summary = submitPatchesBox(vbox2)
me.repos = makeRepoView()
// processing is done. update the repo summary box
me.summary.Update()
me.Enable()
// intermittently scans the status indefinitly
me.repos.View.Watchdog(func() {
log.Info("In main()")
// processing is done. update the repo summary box
me.summary.Update()
})
}