autotypist/main.go

75 lines
1.5 KiB
Go

package main
import (
"embed"
"os"
"go.wit.com/lib/debugger"
"go.wit.com/lib/protobuf/forgepb"
"go.wit.com/log"
"go.wit.com/gui"
)
var VERSION string
//go:embed resources/*
var resources embed.FS
var myargv argv
func main() {
me = new(autoType)
// load the ~/.config/forge/ config
me.forge = forgepb.Init()
me.forge.ConfigPrintTable()
os.Setenv("REPO_WORK_PATH", me.forge.GetGoSrc())
log.DaemonMode(false)
me.myGui = gui.New()
if !myargv.GitPull {
me.myGui.InitEmbed(resources)
me.myGui.Default()
}
me.autotypistWindow = me.myGui.NewWindow("autotypist: it types faster than you can.")
me.mainbox = me.autotypistWindow.NewBox("bw hbox", true)
// start the http server for polling status
go startHTTP()
vbox1 := me.mainbox.NewVerticalBox("BOX1")
globalDisplayOptions(vbox1)
docsBox(vbox1)
if debugger.ArgDebug() {
debuggerBox(vbox1)
}
// disable the interface while everything is scanned
me.Disable()
vbox2 := me.mainbox.NewVerticalBox("BOX2")
globalBuildOptions(vbox2)
// me.summary = submitPatchesBox(vbox2)
globalResetOptions(me.mainbox)
me.repos = makeRepoView()
// process everything on the command line
// may exit here
// handleCmdLine()
// setup the autoscan functions
me.repos.View.RegisterHideFunction(hideFunction)
// 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("watchdog in autotypist main()")
})
}