summaryrefslogtreecommitdiff
path: root/doPatch.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-09 12:13:47 -0500
committerJeff Carr <[email protected]>2025-10-09 12:13:47 -0500
commit7e7ec656192326f9acb6ce046cc142ee4f29dbb8 (patch)
tree219b69c811e460cc386f83659a1bac4172b8f711 /doPatch.go
parent4002b825e36f9e0e3e3733b0857d56be5831ca4c (diff)
more to the more standard subcommand handling
Diffstat (limited to 'doPatch.go')
-rw-r--r--doPatch.go22
1 files changed, 10 insertions, 12 deletions
diff --git a/doPatch.go b/doPatch.go
index 3d92337..89886b8 100644
--- a/doPatch.go
+++ b/doPatch.go
@@ -34,29 +34,29 @@ func isPatchingSafe() bool {
return false
}
-func doPatch() error {
+func doPatch() (string, error) {
if argv.Patch.Submit != nil {
- return doPatchSubmit()
+ return "Submitted", doPatchSubmit()
}
if !isPatchingSafe() {
- return log.Errorf("not safe to work on patches")
+ return "not safe", errors.New("not safe to work on patches")
}
if argv.Patch.Get != nil {
psets := forgepb.NewSets()
newpb, _, _ := psets.HttpPostVerbose(myServer(), "get")
- doPatchGet(newpb)
- return nil
+ footer, err := doPatchGet(newpb)
+ return footer, err
}
if argv.Patch.List != nil {
err := doPatchList()
- return err
+ return "listed patches", err
}
err := doPatchList()
- return err
+ return "listed patches. where is my footer?", err
}
// submit's current working patches
@@ -153,7 +153,7 @@ func applyPatch(repo *gitpb.Repo, p *forgepb.Patch) (string, error) {
return p.NewHash, log.Errorf("did not lookup new hash")
}
-func doPatchGet(newpb *forgepb.Sets) {
+func doPatchGet(newpb *forgepb.Sets) (string, error) {
// var changed bool
curpatches := forgepb.NewPatches()
curpatches.Filename = "/tmp/curpatches.pb"
@@ -168,7 +168,6 @@ func doPatchGet(newpb *forgepb.Sets) {
curpatches.Filename = "/tmp/curpatches.pb"
curpatches.Save()
}
- // newpb.PrintTable()
for pset := range newpb.IterAll() {
if pset.Patches.Len() == 0 {
log.Info("pset is empty", pset.Name)
@@ -202,9 +201,8 @@ func doPatchGet(newpb *forgepb.Sets) {
}
}
curpatches.Save()
- curpatches.PrintTable()
- // me.forge.Patchsets = newpb
- // me.forge.Patchsets.Save()
+ footer := curpatches.PrintTable()
+ return footer, nil
}
var ErrorGitPullOnDirty error = errors.New("git comment is not there")