diff options
| author | Jeff Carr <[email protected]> | 2024-12-05 12:29:47 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-12-05 12:29:47 -0600 |
| commit | 816760d1372d6d1922a9916f3150e49f3fd562cd (patch) | |
| tree | 0889b24fabb5d35dc0db53d0bbf71a985427c89b /main.go | |
| parent | 0463030e80f480f0d38989f4231db8b1651b40bc (diff) | |
developing on this now
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 96 |
1 files changed, 38 insertions, 58 deletions
@@ -6,11 +6,9 @@ import ( "os" "go.wit.com/dev/alexflint/arg" - "go.wit.com/lib/gadgets" "go.wit.com/lib/protobuf/forgepb" + "go.wit.com/lib/protobuf/gitpb" "go.wit.com/log" - - "go.wit.com/gui" ) // sent via -ldflags @@ -23,66 +21,48 @@ func main() { // load the ~/.config/forge/ config me.forge = forgepb.Init() - os.Setenv("REPO_WORK_PATH", me.forge.GetGoSrc()) - - // show your forge config settings - if argv.ListConf { - me.forge.ConfigPrintTable() - os.Exit(0) - } - - // processes any --list like options - // may exit - list() - scan() + me.found = new(gitpb.Repos) - if argv.RedoGoMod { - me.forge.RillRedoGoMod() - os.Exit(0) - repos := me.forge.Repos.SortByGoPath() - for repos.Scan() { - repo := repos.Next() - if !repo.IsValid() { - log.Printf("%10s %-50s", "old?", repo.GetGoPath()) - continue - } - log.Printf("running on: %-50s", repo.GetGoPath()) - if argv.Erase { - repo.EraseGoMod() - } else { - repo.RedoGoMod() - } + // first find the repos or gopaths to operate on + if argv.Config { + if findConfig() { + me.forge.ConfigPrintTable() + os.Exit(0) } + } else { + findRepos() } - me.pp.WriteHelp(os.Stdout) - 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) + log.Info("found", me.found.Len(), "repos. found", len(me.foundPaths), "paths from .config/forge") - me.repos = makeRepoView() - - // processing is done. update the repo summary box - me.summary.Update() + // now, do something to all of them (or just print out a table of them) + var done bool = false + if argv.DoScan { + doScan() + done = true + } - me.Enable() + if argv.DoRedoGoMod { + doRedoGoMod() + done = true + } + if argv.DoGitPull { + doGitPull() + done = true + } + if argv.DoList { + // print out the repos + doCobol() + done = true + } - // 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() - }) + // do the gui at the very end + if argv.DoGui { + doGui() + os.Exit(0) + } + if !done { + // if nothing was selected, print out a table of them on STDOUT + doCobol() + } } |
