From 8b3f289eae2b651ea03ec7af87776bb492ca1bc0 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sat, 16 Aug 2025 17:03:01 -0500 Subject: [PATCH] more generic format table --- humanTable.go | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/humanTable.go b/humanTable.go index 98437dd..850d3d1 100644 --- a/humanTable.go +++ b/humanTable.go @@ -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) +}