summaryrefslogtreecommitdiff
path: root/set.table.go
blob: 49bc60f3a1aa992db0625f8b53d64060f5793480 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// 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 (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 = 28

	col = t.AddCommitHash()
	col.Width = 8

	col = t.AddPatchId()
	col.Width = 8

	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("filename", func(p *Patch) string {
	//		_, base := filepath.Split(p.Filename)
	//		return base
	//	})
	//	col.Width = 24

	col = t.AddComment()
	col.Width = 80
	return t
}

/*
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.AddComment()
	col.Width = -1

	return t
}
*/