From 04661cd2056843d829085eb36b32d061f57275cb Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 8 Oct 2025 01:40:28 -0500 Subject: make easy to use --- Makefile | 3 +++ doGit.go | 18 +++++++++++------- main.go | 7 +++++-- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 86a82ec..496c778 100644 --- a/Makefile +++ b/Makefile @@ -71,6 +71,9 @@ apt-update: -o Dir::Etc::sourceparts=/dev/null \ -o APT::Get::List-Cleanup=0 +commit: + forge commit --all + merge: forge merge --all diff --git a/doGit.go b/doGit.go index 333ed57..ae1cb6f 100644 --- a/doGit.go +++ b/doGit.go @@ -15,7 +15,7 @@ import ( "go.wit.com/log" ) -func doGit() error { +func doGit() (string, error) { log.DaemonMode(true) defer log.DaemonMode(false) @@ -23,7 +23,7 @@ func doGit() error { fstr := "--format=\"%h %>(24)%ar %>(20)%an %s" cmd := []string{"git", "log", fstr} shell.RunVerbose(cmd) - me.sh.GoodExit("") + return "git log", nil } if argv.Git.Tag != nil { @@ -35,6 +35,7 @@ func doGit() error { parts := strings.Split(line, "\x00") log.Infof("LINE: %d len(%d) %v\n", i, len(parts), parts) } + return "git tags", nil } if argv.Git.Who != nil { @@ -48,19 +49,19 @@ func doGit() error { } cmd := []string{"git", "who"} shell.RunVerbose(cmd) - me.sh.GoodExit("") + return "git who", nil } if argv.Git.Pull != nil { doPull(".config/wit") doPull("tools") - me.sh.GoodExit("") + return "git pull", nil } if argv.Git.Push != nil { doPush(".config/wit") doPush("tools") - me.sh.GoodExit("") + return "git push", nil } if argv.Git.DeleteUntracked { @@ -77,13 +78,16 @@ func doGit() error { cmd := []string{"rm"} cmd = append(cmd, files...) _, err := fhelp.RunRealtimeError(cmd) - return err + if err != nil { + log.Info("cmd failed", cmd, repo.FullPath, err) + return "rm failed", err + } } } } } - return nil + return "todo: put something here", nil } func findRepo(wpath string) (*gitpb.Repo, bool) { diff --git a/main.go b/main.go index f8a30c9..8ec2446 100644 --- a/main.go +++ b/main.go @@ -43,8 +43,11 @@ func main() { } if argv.Git != nil { - doGit() - me.sh.GoodExit("") + s, err := doGit() + if err != nil { + me.sh.BadExit(s, err) + } + me.sh.GoodExit(s) } if argv.Clone != nil { -- cgit v1.2.3