blob: cbecfe0ac04ed9cf8c551101de2ef17e4e41cffe (
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
|
// Copyright 2025 WIT.COM Inc Licensed GPL 3.0
package gitpb
import (
"go.wit.com/lib/gui/shell"
"go.wit.com/log"
)
func (pb *Repos) PrintPublishTable() string {
tablePB := pb.MakePublishTable()
tablePB.PrintTable()
var dirty int
// var writable int // need forge to determine this
var bins int
var protos int
for repo := range pb.IterAll() {
if repo.IsDirty() {
dirty += 1
}
if repo.IsBinary() {
bins += 1
}
if repo.IsProtobuf() {
protos += 1
}
}
return log.Sprintf("gitpb.PublishTable: total=(%d) dirty=(%d) binaries=(%d) protobufs(%d)", pb.Len(), dirty, bins, protos)
}
func (pb *Repos) MakePublishTable() *ReposTable {
t := pb.NewTable("gitpb Publish Table")
t.NewUuid()
var col *RepoFunc
col = t.AddNamespace()
col.Width = 33
col = t.AddCurrentBranchName()
col.Width = 7
col.Header.Name = "current"
col = t.AddStringFunc("age", func(r *Repo) string {
if r.IsDirty() {
return ""
}
dur := r.NewestAge()
return shell.FormatDuration(dur)
})
col.Width = 3
col = t.AddMasterVersion()
col.Width = 12
col.Header.Name = "master"
col = t.AddLastTag()
col.Width = 12
col.Header.Name = "lasttag"
col = t.AddTargetVersion()
col.Width = 12
col.Header.Name = "target ver"
col = t.AddStringFunc("type", func(r *Repo) string {
return getRepoType(r)
})
col.Width = 6
col = t.AddState()
col.Width = 16
col = t.AddStateChange()
col.Width = 20
col = t.AddURL()
col.Width = -1
return t
}
|