summaryrefslogtreecommitdiff
path: root/tableStats.go
diff options
context:
space:
mode:
Diffstat (limited to 'tableStats.go')
-rw-r--r--tableStats.go44
1 files changed, 41 insertions, 3 deletions
diff --git a/tableStats.go b/tableStats.go
index f229553..06115dd 100644
--- a/tableStats.go
+++ b/tableStats.go
@@ -3,6 +3,9 @@
package gitpb
import (
+ "fmt"
+ "strings"
+
"go.wit.com/lib/cobol"
"go.wit.com/log"
)
@@ -32,17 +35,52 @@ func (pb *Stats) MakeTable(name string) *StatsTable {
col = t.AddPatchId()
col.Width = 10
- col = t.AddHash()
+ col = t.AddStringFunc("Hash", func(r *Stat) string {
+ if r.Hash != "" {
+ return fmt.Sprintf("Hash(%8.8s)", r.Hash)
+ }
+ if r.TreeHash != "" {
+ return fmt.Sprintf("Tree(%8.8s)", r.TreeHash)
+ }
+ if r.TagHash != "" {
+ return fmt.Sprintf("Tag (%8.8s)", r.TagHash)
+ }
+ return fmt.Sprintf(" (%8.8s)", "")
+ })
col.Width = 20
col.Header.Name = "Git Hash"
col = t.AddStringFunc("age", func(r *Stat) string {
return cobol.Time(r.CommitTime)
})
- col.Width = 28
+ col.Width = 27
+
+ col = t.AddTags()
+ col.Width = 20
+
+ // col = t.AddName()
+ // col.Width = 30
col = t.AddStringFunc("Name", func(r *Stat) string {
- return r.SanitizedSubject
+ if strings.HasPrefix(r.Name, "refs/tags/") {
+ return strings.TrimPrefix(r.Name, "refs/tags/")
+ }
+ if strings.HasPrefix(r.Name, "refs/heads/") {
+ return strings.TrimPrefix(r.Name, "refs/heads/")
+ }
+ if strings.HasPrefix(r.Name, "refs/remotes/") {
+ return strings.TrimPrefix(r.Name, "refs/remotes/")
+ }
+ if strings.HasPrefix(r.Name, "refs/") {
+ return strings.TrimPrefix(r.Name, "refs/")
+ }
+ return fmt.Sprintf("%s", r.Name)
+ })
+ col.Width = 16
+
+ col = t.AddStringFunc("Submect", func(r *Stat) string {
+ // return fmt.Sprintf("subject(%s) name(%s)", r.SanitizedSubject, r.Name)
+ return fmt.Sprintf("%s", r.SanitizedSubject)
})
col.Width = -1