diff options
| author | Jeff Carr <[email protected]> | 2024-11-08 06:43:33 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-11-08 06:43:33 -0600 |
| commit | 55acea0bd769132db7bf420fef3b94fa21ca5f83 (patch) | |
| tree | d43fb2b485cf0b1439a48037cf129a76e1d53ad0 /tagWindow.go | |
| parent | 29545d3f048ccb148429725d76d0894336985c2b (diff) | |
use go-cmd/cmdv0.22.12
Diffstat (limited to 'tagWindow.go')
| -rw-r--r-- | tagWindow.go | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/tagWindow.go b/tagWindow.go index 5f7c7f7..4f0efbc 100644 --- a/tagWindow.go +++ b/tagWindow.go @@ -1,6 +1,7 @@ package repostatus import ( + "errors" "path/filepath" "regexp" "slices" @@ -44,10 +45,10 @@ type GitTagBox struct { tags []*Tag } -func (rs *RepoStatus) makeTagBox(box *gui.Node) { +func (rs *RepoStatus) makeTagBox(box *gui.Node) error { if rs.Tags != nil { log.Log(WARN, "already scanned tags") - return + return errors.New("already scanned tags") } tagB := new(GitTagBox) rs.Tags = tagB @@ -98,12 +99,13 @@ func (rs *RepoStatus) makeTagBox(box *gui.Node) { format := strings.Join(tags, "_,,,_") cmd := []string{"git", "for-each-ref", "--sort=taggerdate", "--format", format} // log.Info("RUNNING:", strings.Join(cmd, " ")) - err, output := rs.RunCmd(cmd) - if err != nil { - output = "git error_,,,_a_,,,_b_,,,c" + r := rs.Run(cmd) + if r.Error != nil { + log.Warn("git for-each-ref error:", r.Error) + return r.Error } - lines := strings.Split(output, "\n") + lines := r.Stdout // reverse the git order slices.Reverse(lines) tagB.tags = make([]*Tag, 0) @@ -146,6 +148,7 @@ func (rs *RepoStatus) makeTagBox(box *gui.Node) { } // reverse the git order // slices.Reverse(rtags.tags) + return nil } func (rtags *GitTagBox) ListAll() []*Tag { @@ -246,18 +249,20 @@ func (rtags *GitTagBox) PruneSmart() { func (rs *RepoStatus) DeleteTag(rt *Tag) { cmd := []string{"git", "push", "--delete", "origin", rt.tag.String()} log.Info("RUN:", cmd) - err, output := rs.RunCmd(cmd) - if err != nil { - log.Info("cmd failed", err) + r := rs.Run(cmd) + output := strings.Join(r.Stdout, "\n") + if r.Error != nil { + log.Info("cmd failed", r.Error) log.Info("output:", output) } log.Info("output:", output) cmd = []string{"git", "tag", "--delete", rt.tag.String()} log.Info("RUN:", cmd) - err, output = rs.RunCmd(cmd) - if err != nil { - log.Info("cmd failed", err) + r = rs.Run(cmd) + output = strings.Join(r.Stdout, "\n") + if r.Error != nil { + log.Info("cmd failed", r.Error) log.Info("output:", output) } log.Info("output:", output) |
