summaryrefslogtreecommitdiff
path: root/tableForged.go
blob: 721f9a572d2586f30c545792186a5435b391d2a2 (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
// Copyright 2025 WIT.COM Inc Licensed GPL 3.0

package gitpb

import (
	"go.wit.com/log"
)

func (pb *Repos) PrintForgedTable() string {
	tablePB := pb.MakeForgedTable()
	tablePB.PrintTable()
	return log.Sprintf("fpb.ForgedTable: %d repos", pb.Len())
}

func (pb *Repos) MakeForgedTable() *ReposTable {
	t := pb.NewTable("forgedList")
	t.NewUuid()

	var col *RepoFunc

	col = t.AddMasterBranchName()
	col.Width = 3

	col = t.AddMasterVersion()
	col.Width = 10

	col = t.AddStringFunc("hash", func(r *Repo) string {
		if r.MasterStat != nil {
			return r.MasterStat.Hash
		}
		return "fixme []Stat"
	})
	col.Width = 6

	col = t.AddDevelBranchName()
	col.Width = 3

	col = t.AddDevelVersion()
	col.Width = 10

	col = t.AddStringFunc("hash", func(r *Repo) string {
		if r.DevelStat != nil {
			return r.DevelStat.Hash
		}
		return "fixme []Stat"
	})
	col.Width = 6

	col = t.AddState()
	col.Width = 16

	col = t.AddNamespace()
	col.Width = 42

	col = t.AddURL()
	col.Width = -1
	return t
}