diff options
| author | Jeff Carr <[email protected]> | 2025-10-28 08:40:51 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-28 08:40:51 -0500 |
| commit | c5a92b421f202a5b8c807d618aa6edf1cb7db325 (patch) | |
| tree | 43606ecee91d7f138c14d1f4e220e4f16385f803 /tableGolang.go | |
| parent | 356cb6b9f9a6f61ca4f26fa20d068a6b905e8122 (diff) | |
trying to improve user handling
Diffstat (limited to 'tableGolang.go')
| -rw-r--r-- | tableGolang.go | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/tableGolang.go b/tableGolang.go new file mode 100644 index 0000000..364aa77 --- /dev/null +++ b/tableGolang.go @@ -0,0 +1,58 @@ +// Copyright 2025 WIT.COM Inc Licensed GPL 3.0 + +package forgepb + +import ( + "go.wit.com/lib/protobuf/gitpb" + "go.wit.com/log" +) + +func (f *Forge) PrintGolangTB(pb *gitpb.Repos) string { + pb.SortByUserVersion() + tablePB := f.makeDefaultTB(pb) + tablePB.PrintTable() + var dirty int + var writable int + 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 + } + if f.Config.IsWritable(repo.Namespace) { + writable += 1 + } + } + return log.Sprintf("f.GolangRepos: total=(%d) dirty=(%d) writable=(%d) binaries=(%d) protobufs(%d)", pb.Len(), dirty, writable, bins, protos) +} + +func (f *Forge) makeGolangTB(pb *gitpb.Repos) *gitpb.ReposTable { + t := f.makeDefaultBaseTB(pb) + var col *gitpb.RepoFunc + + col = t.AddStringFunc("type", func(r *gitpb.Repo) string { + return f.getRepoType(r) + }) + col.Width = 6 + + col = t.AddStringFunc("r/w", func(r *gitpb.Repo) string { + if f.IsWritable(r) { + return "rw" + } + return "" + }) + col.Width = 3 + + col = t.AddState() + col.Width = 12 + + col = t.AddURL() + col.Width = -1 + return t +} |
