2024-01-09 01:16:00 -06:00
|
|
|
package main
|
|
|
|
|
2024-01-18 00:58:14 -06:00
|
|
|
import (
|
2024-01-15 08:11:08 -06:00
|
|
|
"embed"
|
2024-01-09 10:21:58 -06:00
|
|
|
|
2024-02-13 09:18:04 -06:00
|
|
|
"go.wit.com/lib/debugger"
|
2024-11-15 20:06:17 -06:00
|
|
|
"go.wit.com/log"
|
2024-01-09 02:00:51 -06:00
|
|
|
|
2024-01-18 05:03:04 -06:00
|
|
|
"go.wit.com/gui"
|
2024-01-09 01:16:00 -06:00
|
|
|
)
|
|
|
|
|
2024-11-05 07:48:22 -06:00
|
|
|
var VERSION string
|
2024-11-07 08:25:11 -06:00
|
|
|
|
2024-01-15 21:11:28 -06:00
|
|
|
//go:embed resources/*
|
2024-11-04 03:23:28 -06:00
|
|
|
var resources embed.FS
|
2024-11-05 07:48:22 -06:00
|
|
|
var myargv argv
|
2024-01-15 08:11:08 -06:00
|
|
|
|
2024-01-09 01:16:00 -06:00
|
|
|
func main() {
|
2024-01-23 11:22:33 -06:00
|
|
|
me = new(autoType)
|
2024-01-18 05:03:04 -06:00
|
|
|
|
2024-11-15 20:06:17 -06:00
|
|
|
log.DaemonMode(false)
|
2024-01-18 05:03:04 -06:00
|
|
|
me.myGui = gui.New()
|
2024-11-13 21:30:42 -06:00
|
|
|
if !myargv.GitPull {
|
|
|
|
me.myGui.InitEmbed(resources)
|
|
|
|
me.myGui.Default()
|
|
|
|
}
|
2024-01-09 01:16:00 -06:00
|
|
|
|
2024-02-13 09:18:04 -06:00
|
|
|
me.autotypistWindow = me.myGui.NewWindow("autotypist: it types faster than you can.")
|
2024-02-13 16:18:37 -06:00
|
|
|
me.mainbox = me.autotypistWindow.NewBox("bw hbox", true)
|
2024-02-11 20:24:40 -06:00
|
|
|
|
2024-11-04 03:23:28 -06:00
|
|
|
// start the http server for polling status
|
|
|
|
go startHTTP()
|
|
|
|
|
2024-02-13 16:18:37 -06:00
|
|
|
vbox1 := me.mainbox.NewVerticalBox("BOX1")
|
2024-02-12 15:24:35 -06:00
|
|
|
globalDisplayOptions(vbox1)
|
2024-02-13 13:24:07 -06:00
|
|
|
docsBox(vbox1)
|
2024-02-13 09:18:04 -06:00
|
|
|
if debugger.ArgDebug() {
|
|
|
|
debuggerBox(vbox1)
|
|
|
|
}
|
2024-02-13 16:18:37 -06:00
|
|
|
// disable the interface while everything is scanned
|
|
|
|
me.Disable()
|
2024-02-12 15:24:35 -06:00
|
|
|
|
2024-02-13 16:18:37 -06:00
|
|
|
vbox2 := me.mainbox.NewVerticalBox("BOX2")
|
2024-02-12 15:24:35 -06:00
|
|
|
globalBuildOptions(vbox2)
|
2024-02-21 11:18:16 -06:00
|
|
|
// me.summary = submitPatchesBox(vbox2)
|
2024-02-12 15:24:35 -06:00
|
|
|
|
2024-02-13 16:18:37 -06:00
|
|
|
globalResetOptions(me.mainbox)
|
2024-02-11 20:24:40 -06:00
|
|
|
|
2024-02-17 14:20:37 -06:00
|
|
|
me.repos = makeRepoView()
|
2024-02-17 08:38:44 -06:00
|
|
|
|
2024-02-18 07:24:56 -06:00
|
|
|
// parse config file and scan for .git repos
|
|
|
|
me.repos.initRepoList()
|
|
|
|
|
|
|
|
// reads in the State of all the repos
|
|
|
|
// TODO: should not really be necessary directly after init()
|
|
|
|
me.repos.View.ScanRepositories()
|
2024-01-30 13:09:24 -06:00
|
|
|
|
2024-02-10 16:35:58 -06:00
|
|
|
// process everything on the command line
|
2024-02-18 07:24:56 -06:00
|
|
|
// may exit here
|
2024-02-10 16:35:58 -06:00
|
|
|
handleCmdLine()
|
|
|
|
|
2024-02-22 07:55:01 -06:00
|
|
|
// setup the autoscan functions
|
|
|
|
me.repos.View.RegisterHideFunction(hideFunction)
|
|
|
|
|
2024-02-14 13:43:43 -06:00
|
|
|
// processing is done. update the repo summary box
|
2024-02-21 11:18:16 -06:00
|
|
|
// me.summary.Update()
|
2024-02-14 13:43:43 -06:00
|
|
|
|
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() {
|
2024-02-29 09:22:26 -06:00
|
|
|
// log.Info("watchdog in autotypist main()")
|
2024-02-18 07:24:56 -06:00
|
|
|
})
|
2024-01-09 01:16:00 -06:00
|
|
|
}
|