diff options
| author | Jeff Carr <[email protected]> | 2025-09-23 09:02:19 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-09-23 09:02:19 -0500 |
| commit | 643be0abeac87f4d71c43c221410b6bfc3191962 (patch) | |
| tree | 127b3cae3b9a3a43536c42bb7cdf717575874c0f /set.table.go | |
| parent | 81fc15e743f0c2acfbf2520a9ed2bfbcba431b12 (diff) | |
set PB tables are working
Diffstat (limited to 'set.table.go')
| -rw-r--r-- | set.table.go | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/set.table.go b/set.table.go new file mode 100644 index 0000000..8194346 --- /dev/null +++ b/set.table.go @@ -0,0 +1,93 @@ +// Copyright 2025 WIT.COM Inc Licensed GPL 3.0 + +package forgepb + +import ( + "time" + + "go.wit.com/lib/cobol" + "go.wit.com/log" +) + +func (pset *Set) PrintTable() { + if pset == nil || pset.Patches == nil { + return + } + log.DaemonMode(true) // don't timestamp lines + + tablePB := pset.Patches.makeStandardTable() + tablePB.MakeTable() + tablePB.PrintTable() +} + +func (pb *Sets) makeStandardTablePB() *SetsTable { + t := pb.NewTable("tagList") + t.NewUuid() + + col := t.AddUuid() + col.Width = 12 + + col = t.AddTimeFunc("ctime", func(pset *Set) time.Time { + // todo + return pset.Ctime.AsTime() + }) + col.Width = 4 + + /* + col = t.AddTimeFunc("age", func(repo *gitpb.GitTag) time.Time { + // todo + return time.Now() + }) + col.Width = 4 + + col = t.AddStringFunc("Ref Name", func(r *gitpb.GitTag) string { + _, ref := filepath.Split(r.GetRefname()) + return ref + }) + col.Width = 16 + */ + + col = t.AddComment() + col.Width = -1 + + return t +} + +func (mt *PatchesTable) PrintTable() { + // log.Info("ShowTable() SENDING TO GUI") + mt.MakeTable() + cobol.PrintTable(mt.pb) +} + +func (pb *Patches) makeStandardTable() *PatchesTable { + t := pb.NewTable("tagList") + t.NewUuid() + + col := t.AddNamespace() + col.Width = 12 + + col = t.AddTimeFunc("ctime", func(p *Patch) time.Time { + // todo + return p.Ctime.AsTime() + }) + col.Width = 4 + + /* + col = t.AddTimeFunc("age", func(repo *gitpb.GitTag) time.Time { + // todo + return time.Now() + }) + col.Width = 4 + + col = t.AddStringFunc("Ref Name", func(r *gitpb.GitTag) string { + _, ref := filepath.Split(r.GetRefname()) + return ref + }) + col.Width = 16 + */ + + col = t.AddComment() + col.Width = -1 + + return t +} |
