diff options
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 63 |
1 files changed, 22 insertions, 41 deletions
@@ -2,9 +2,12 @@ package main import ( "embed" - "time" + "os/user" + "strings" "go.wit.com/lib/debugger" + "go.wit.com/lib/gui/repolist" + "go.wit.com/lib/gui/repostatus" "go.wit.com/log" "go.wit.com/gui" @@ -15,7 +18,6 @@ var resToolkit embed.FS func main() { me = new(autoType) - me.allrepos = make(map[string]*repo) me.myGui = gui.New() me.myGui.InitEmbed(resToolkit) @@ -39,52 +41,31 @@ func main() { globalResetOptions(me.mainbox) - repolistWindow() + me.repoView = repolist.AutotypistView() + + usr, _ := user.Current() + if args.OnlyMe { + log.Info("not scanning everything") + } else { + log.Info("scanning everything in ~/go/src") + for i, path := range repostatus.ListGitDirectories() { + // log.Info("addRepo()", i, path) + path = strings.TrimPrefix(path, me.goSrcPwd.String()) + path = strings.Trim(path, "/") + log.Info("addRepo()", i, path) + me.repoView.AddRepo(path, "master", "devel", usr.Username) + } + } // process everything on the command line handleCmdLine() - for _, repo := range me.allrepos { - repo.newScan() - } + repolist.ScanRepositories() me.Enable() // processing is done. update the repo summary box me.summary.Update() - // scan repos every i seconds - // check every 'delay seconds for the checkbox changing - // this logic is unintuitive because I want it to fluidly - // never tricker quickly but also want to print something - // out that the app is alive since, technically - // the GUI is *NOT* this app and could be alive when - // the application is actually stalled somewhere - // plus these things are fun for me and a distraction when - // I've been working 50 days in a row on this gui code - - // this also means that if you click the checkbox after - // the delay, then the scan will run right away, but if - // you check the checkbox twice in 5 seconds, it won't - // rerun until the delay again - var delay int = 99 - var i int = delay - myTicker(1*time.Second, "newScan()", func() { - i += 1 - // check if the checkbox is checked - if !me.autoScanReposCB.Checked() { - if i < delay { - i = delay - } - // print every 'delay' seconds - if i%delay == 0 { - log.Info("Not auto scanning", i) - } - return - } - if i < delay { - return - } - i = 0 - scanRepositories() - }) + // intermittently scans the status indefinitly + repolist.Watchdog() } |
