diff options
| author | Jeff Carr <[email protected]> | 2025-10-05 03:55:22 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-05 03:55:22 -0500 |
| commit | 952334bf58e49e381171e2c71e20a847f4138df6 (patch) | |
| tree | f430252265c34d30162027c0bf657cfbfe52a841 /tableForged.go | |
| parent | 8d50f01597cde8c7ae0fd451347d93196b97f900 (diff) | |
code cleanups. old non-protobuf code almost gonev0.0.166
Diffstat (limited to 'tableForged.go')
| -rw-r--r-- | tableForged.go | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/tableForged.go b/tableForged.go new file mode 100644 index 0000000..19d0818 --- /dev/null +++ b/tableForged.go @@ -0,0 +1,60 @@ +// Copyright 2025 WIT.COM Inc Licensed GPL 3.0 + +package forgepb + +import ( + "go.wit.com/lib/protobuf/gitpb" +) + +func (f *Forge) PrintForgedTable(pb *gitpb.Repos) { + tablePB := f.makeForgedTable(pb) + tablePB.PrintTable() +} + +func (f *Forge) makeForgedTable(pb *gitpb.Repos) *gitpb.ReposTable { + t := pb.NewTable("forgedList") + t.NewUuid() + + var col *gitpb.RepoFunc + + col = t.AddMasterBranchName() + col.Width = 3 + + col = t.AddMasterVersion() + col.Width = 10 + + col = t.AddStringFunc("hash", func(r *gitpb.Repo) string { + if r.Tags == nil { + return "nil" + } + if r.Tags.Master == nil { + return "nil" + } + return r.Tags.Master.Hash + }) + col.Width = 6 + + col = t.AddDevelBranchName() + col.Width = 3 + + col = t.AddDevelVersion() + col.Width = 10 + + col = t.AddStringFunc("hash", func(r *gitpb.Repo) string { + if r.Tags == nil { + return "nil" + } + if r.Tags.Devel == nil { + return "nil" + } + return r.Tags.Devel.Hash + }) + col.Width = 6 + + col = t.AddNamespace() + col.Width = 42 + + col = t.AddURL() + col.Width = -1 + return t +} |
