lazy code move to shell

This commit is contained in:
Jeff Carr 2024-02-22 15:54:00 -06:00
parent db6ede257c
commit 7078066691
3 changed files with 18 additions and 6 deletions

View File

@ -40,6 +40,10 @@ func argCheckoutDevel() bool {
me.autotypistWindow.Hide()
var failed int = 0
for _, repo := range repolist.AllRepos() {
if repo.Status.ReadOnly() {
// log.Info("skipping read-only", repo.Name())
continue
}
if repo.CheckDirty() {
log.Info("skipping dirty repo", repo.Name())
continue
@ -67,11 +71,19 @@ func argCheckoutUser() bool {
me.autotypistWindow.Hide()
var failed int = 0
for _, repo := range repolist.AllRepos() {
if repo.Status.ReadOnly() {
// log.Info("skipping read-only", repo.Name())
continue
}
if repo.Status.CheckDirty() {
log.Info("skipping dirty repo", repo.Name())
continue
}
branch := repo.Status.GetUserBranchName()
if branch == repo.Status.GetCurrentBranchName() {
// already on user branch
continue
}
cmd := []string{"git", "checkout", branch}
log.Info("Running:", cmd, "in", repo.Name())
err, output := repo.RunCmd(cmd)

View File

@ -9,8 +9,8 @@ import (
"path/filepath"
"strings"
"go.wit.com/lib/gui/repolist"
"go.wit.com/lib/gui/repostatus"
"go.wit.com/lib/gui/shell"
"go.wit.com/log"
)
@ -61,10 +61,10 @@ func parsecfg(f string) []string {
func splitLine(line string) (string, string, string, string) {
var path, master, devel, user string
parts := strings.Split(line, " ")
path, parts = repolist.RemoveFirstElement(parts)
master, parts = repolist.RemoveFirstElement(parts)
devel, parts = repolist.RemoveFirstElement(parts)
user, parts = repolist.RemoveFirstElement(parts)
path, parts = shell.RemoveFirstElement(parts)
master, parts = shell.RemoveFirstElement(parts)
devel, parts = shell.RemoveFirstElement(parts)
user, parts = shell.RemoveFirstElement(parts)
// path, master, devel, user := strings.Split(line, " ")
return path, master, devel, user
}