diff options
| author | Jeff Carr <[email protected]> | 2025-10-30 00:12:44 -0500 | 
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-30 00:12:44 -0500 | 
| commit | ea0ceddfa9c40b87568a460a7f2ea3cd3bd2021f (patch) | |
| tree | 7a88c28a88f06789047452954be149eed9e1954f | |
| parent | d62ff87615b40c269ff9c0e340d3b4b403aa6b5a (diff) | |
new better smarter table
| -rw-r--r-- | tablePublish.go | 1 | ||||
| -rw-r--r-- | tablePublishNew.go | 74 | 
2 files changed, 75 insertions, 0 deletions
diff --git a/tablePublish.go b/tablePublish.go index cbecfe0..b80018d 100644 --- a/tablePublish.go +++ b/tablePublish.go @@ -27,6 +27,7 @@ func (pb *Repos) PrintPublishTable() string {  	}  	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() diff --git a/tablePublishNew.go b/tablePublishNew.go new file mode 100644 index 0000000..a3d9a32 --- /dev/null +++ b/tablePublishNew.go @@ -0,0 +1,74 @@ +// 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) PrintPublishNewTB() string { +	tablePB := pb.MakePublishNewTB() +	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.PublishNewTB:  total=(%d)   dirty=(%d)  binaries=(%d)  protobufs(%d)", pb.Len(), dirty, bins, protos) +} + +func (pb *Repos) MakePublishNewTB() *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 = -1 + +	return t +}  | 
