diff options
| author | Jeff Carr <[email protected]> | 2024-02-21 08:32:59 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-02-21 08:32:59 -0600 |
| commit | df0ff5af1cd92287f79c7033cde4d339e0d8b628 (patch) | |
| tree | 9230b0b2cc4d4e776c0a91e50f36c6685f92a764 /handleCmdLine.go | |
| parent | 42c506c0982ea85d54443a39e4995c44060287df (diff) | |
purge code for the autotypist
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'handleCmdLine.go')
| -rw-r--r-- | handleCmdLine.go | 123 |
1 files changed, 0 insertions, 123 deletions
diff --git a/handleCmdLine.go b/handleCmdLine.go deleted file mode 100644 index fdafcbe..0000000 --- a/handleCmdLine.go +++ /dev/null @@ -1,123 +0,0 @@ -package main - -import ( - "os" - - "go.wit.com/lib/gui/repolist" - "go.wit.com/log" -) - -/* -This will process the command line arguements like --git-pull - -It should do them in a smart order. If any of them are called, -don't show the GUI at all and just exit. -*/ - -func argGitPull() bool { - log.Info("running git pull everywhere") - me.autotypistWindow.Hide() - cmd := []string{"git", "pull"} - var failed int = 0 - for _, repo := range repolist.AllRepos() { - log.Info("Running:", repo.Status.Path(), cmd) - err, output := repo.RunCmd(cmd) - if err == nil { - log.Info(output) - } else { - failed += 1 - log.Info("Something went wrong. Got err", err) - log.Info("output =", output) - return false - } - } - log.Info("Ran git pull in all repos. failure count =", failed) - return true -} - -func argCheckoutDevel() bool { - log.Info("running git checkout devel everwhere") - me.autotypistWindow.Hide() - var failed int = 0 - for _, repo := range repolist.AllRepos() { - if repo.CheckDirty() { - log.Info("skipping dirty repo", repo.Name()) - continue - } - branch := repo.Status.GetDevelBranchName() - cmd := []string{"git", "checkout", branch} - log.Info("Running:", cmd, "in", repo.Name()) - err, output := repo.RunCmd(cmd) - if err == nil { - log.Info("git checkout worked", output) - } else { - failed += 1 - log.Info("git checkout failed") - log.Info("Something went wrong. Got err", err) - log.Info("output =", output) - // return false - } - } - log.Info("Ran git checkout in all repos. failure count =", failed) - return true -} - -func argCheckoutUser() bool { - log.Info("running git checkout devel everwhere") - me.autotypistWindow.Hide() - var failed int = 0 - for _, repo := range repolist.AllRepos() { - if repo.Status.CheckDirty() { - log.Info("skipping dirty repo", repo.Name()) - continue - } - branch := repo.Status.GetUserBranchName() - cmd := []string{"git", "checkout", branch} - log.Info("Running:", cmd, "in", repo.Name()) - err, output := repo.RunCmd(cmd) - if err == nil { - log.Info("git checkout worked", output) - } else { - failed += 1 - log.Info("git checkout failed") - log.Info("Something went wrong. Got err", err) - log.Info("output =", output) - // return false - } - } - log.Info("Ran git checkout in all repos. failure count =", failed) - return true -} - -func handleCmdLine() { - var doExit bool = false - - if args.CheckoutDevel { - argCheckoutDevel() - doExit = true - } else { - log.Info("not switching to devel branches") - } - - if args.CheckoutUser { - argCheckoutUser() - doExit = true - } else { - log.Info("not switching to user branches") - } - - if args.GitPull { - if argGitPull() { - log.Info("git pull everywhere worked") - } else { - log.Info("git failed somewhere") - } - doExit = true - } else { - log.Info("not running git pull everywhere") - } - - if doExit { - os.Exit(0) - } -} |
