diff options
| author | Jeff Carr <[email protected]> | 2025-09-22 23:02:59 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-09-22 23:02:59 -0500 |
| commit | e300719241a8bfe62db429f349315ff15816062d (patch) | |
| tree | bfb4fe71330292b23165317fb8ccbf42d7b38fe8 /doTag.go | |
| parent | a9c4b21b355ee00cc5241f39b745d2306579dfd1 (diff) | |
cleanup tag list
Diffstat (limited to 'doTag.go')
| -rw-r--r-- | doTag.go | 40 |
1 files changed, 23 insertions, 17 deletions
@@ -39,7 +39,7 @@ func doTag() error { if argv.Tag.List != nil { repo := findCurrentPwdRepoOrDie() - tagTablePB := makeTagTablePB(repo.Tags) + tagTablePB := makeTagTablePB(repo, repo.Tags) // tbox := win.Bottom.Box().SetProgName("TBOX") // t.SetParent(tbox) tagTablePB.MakeTable() @@ -80,40 +80,46 @@ func doTag() error { return nil } -func makeTagTablePB(pb *gitpb.GitTags) *gitpb.GitTagsTable { +func makeTagTablePB(repo *gitpb.Repo, pb *gitpb.GitTags) *gitpb.GitTagsTable { t := pb.NewTable("tagList") t.NewUuid() col := t.AddHash() col.Width = 12 - col = t.AddStringFunc("Ref Name", func(r *gitpb.GitTag) string { - _, ref := filepath.Split(r.GetRefname()) - return ref - }) - col.Width = 16 - // col.Width = -1 - - col = t.AddTimeFunc("age", func(repo *gitpb.GitTag) time.Time { - // todo - return time.Now() + col = t.AddStringFunc("bashash", func(tag *gitpb.GitTag) string { + _, base := filepath.Split(tag.Refname) + cmd, err := repo.RunStrict([]string{"git", "log", "-1", base, "--format=%H"}) + if err != nil { + return "err" + } + if len(cmd.Stdout) == 0 { + return "" + } + return cmd.Stdout[0] }) - col.Width = 6 + col.Width = 12 col = t.AddTimeFunc("ctime", func(tag *gitpb.GitTag) time.Time { // todo return tag.Creatordate.AsTime() }) - col.Width = 16 + col.Width = 4 - col = t.AddIntFunc("int", func(tag *gitpb.GitTag) int { + col = t.AddTimeFunc("age", func(repo *gitpb.GitTag) time.Time { // todo - return 3 + return time.Now() }) col.Width = 4 - col = t.AddSubject() + col = t.AddStringFunc("Ref Name", func(r *gitpb.GitTag) string { + _, ref := filepath.Split(r.GetRefname()) + return ref + }) col.Width = 16 + col = t.AddSubject() + col.Width = -1 + return t } |
