diff options
| -rw-r--r-- | human.go | 2 | ||||
| -rw-r--r-- | humanBuildTable.go | 66 | ||||
| -rw-r--r-- | humanForgedTable.go | 2 |
3 files changed, 68 insertions, 2 deletions
@@ -124,7 +124,7 @@ func (f *Forge) makePullTable(pb *gitpb.Repos) *gitpb.ReposTable { t := pb.NewTable("pullTable") t.NewUuid() - var col *gitpb.RepoAnyFunc + var col *gitpb.RepoFunc // var col int col = t.AddMasterBranchName() diff --git a/humanBuildTable.go b/humanBuildTable.go new file mode 100644 index 0000000..6c2102e --- /dev/null +++ b/humanBuildTable.go @@ -0,0 +1,66 @@ +// Copyright 2025 WIT.COM Inc Licensed GPL 3.0 + +package forgepb + +import ( + "go.wit.com/lib/protobuf/gitpb" +) + +func (f *Forge) getPackageVersion(repo *gitpb.Repo) string { + var s string + + s = repo.GetCurrentBranchVersion() + if repo.IsDirty() { + s += "-dirty" + } + return s +} + +func (f *Forge) getRepoType(repo *gitpb.Repo) string { + var rtype string = repo.GetRepoType() + switch rtype { + case "binary": + rtype = "GO bin" + case "library": + rtype = "GO lib" + case "protobuf": + rtype = "GO pb" + } + if f.IsPrivate(repo) { + rtype = "priv" + } + return rtype +} + +func (f *Forge) isInstalled(repo *gitpb.Repo) string { + return "X" +} + +func (f *Forge) GetBuildBaseTB(pb *gitpb.Repos) *gitpb.ReposTable { + t := pb.NewTable(".deb details") + t.NewUuid() + + var col *gitpb.RepoFunc + + col = t.AddStringFunc("Build Version", func(r *gitpb.Repo) string { + return f.getPackageVersion(r) + }) + col.Width = 24 + + col = t.AddState() + col.Width = 32 + + col = t.AddStringFunc("RepoType", func(r *gitpb.Repo) string { + return f.getRepoType(r) + }) + col.Width = 8 + + col = t.AddStringFunc("I", func(r *gitpb.Repo) string { + return f.isInstalled(r) + }) + col.Width = 2 + + col = t.AddNamespace() + col.Width = 22 + return t +} diff --git a/humanForgedTable.go b/humanForgedTable.go index 96472da..19d0818 100644 --- a/humanForgedTable.go +++ b/humanForgedTable.go @@ -15,7 +15,7 @@ func (f *Forge) makeForgedTable(pb *gitpb.Repos) *gitpb.ReposTable { t := pb.NewTable("forgedList") t.NewUuid() - var col *gitpb.RepoAnyFunc + var col *gitpb.RepoFunc col = t.AddMasterBranchName() col.Width = 3 |
