more generic format table

This commit is contained in:
Jeff Carr 2025-08-16 17:03:01 -05:00
parent 8e8d9e9a69
commit 8b3f289eae
1 changed files with 45 additions and 0 deletions

View File

@ -54,6 +54,25 @@ func (f *Forge) PrintHumanTable(allr *gitpb.Repos) {
log.Info("Total git repositories:", count)
}
func (f *Forge) PrintForgedTable(allr *gitpb.Repos) {
log.DaemonMode(true)
var count int
// print the header
args := []string{"namespace", "cur br", "age", "master", "devel", "last tag", "", "", "", ""}
sizes := []int{40, 12, 6, 12, 16, 16, 16, 12, 12, 8}
log.Info(standardTableSize10(sizes, args))
all := allr.SortByFullPath()
for all.Scan() {
repo := all.Next()
f.printForgedToTable(repo, sizes)
count += 1
}
log.Info("Total git repositories:", count)
}
func (f *Forge) PrintHumanTableFull(allr *gitpb.Repos) {
log.DaemonMode(true)
@ -248,3 +267,29 @@ func (f *Forge) printRepoToTable(repo *gitpb.Repo, sizes []int, full bool) {
log.Info(start, end)
}
func (f *Forge) printForgedToTable(repo *gitpb.Repo, sizes []int) {
var end string
// shortened version numbers
var mhort string = repo.GetMasterVersion()
var dhort string = repo.GetDevelVersion()
var lasttag string = repo.GetLastTag()
var cname string = repo.GetCurrentBranchName()
var ns string = repo.GetNamespace()
// ctime := repo.Tags.GetAge(mhort)
// age := shell.FormatDuration(time.Since(ctime))
age := shell.FormatDuration(repo.BranchAge(cname))
var args []string
// args = []string{cname, age, mhort, dhort, uhort, chort, lasttag, thort, rtype, gopath}
args = []string{ns, cname, age, mhort, dhort, lasttag, "", "", "", ""}
start := standardTableSize10(sizes, args)
end += "todo"
log.Info(start, end)
}