From e506a733498e35503208fb726b3b1d8cb470c572 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 4 Sep 2025 08:05:19 -0500 Subject: [PATCH] use cobol.TerminalChomp() for readability --- humanTable.go | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/humanTable.go b/humanTable.go index d3980d2..339548f 100644 --- a/humanTable.go +++ b/humanTable.go @@ -44,7 +44,7 @@ func (f *Forge) PrintHumanTable(allr *gitpb.Repos) { // print the header args := []string{"namespace", "cur br", "age", "master", "devel", "user", "curver", "lasttag", "next", "repo type"} sizes := []int{40, 12, 6, 12, 16, 16, 16, 12, 12, 8} - log.Info(standardTableSize10(sizes, args)) + log.Info(cobol.TerminalChomp(standardTableSize10(sizes, args))) all := allr.SortByFullPath() for all.Scan() { @@ -63,7 +63,7 @@ func (f *Forge) PrintForgedTable(allr *gitpb.Repos) { // 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)) + log.Info(cobol.TerminalChomp(standardTableSize10(sizes, args))) all := allr.SortByFullPath() for all.Scan() { @@ -82,7 +82,7 @@ func (f *Forge) PrintHumanTableFull(allr *gitpb.Repos) { // print the header args := []string{"cur br", "age", "master", "devel", "user", "curver", "lasttag", "next", "repo type", "namespace"} sizes := []int{12, 6, 12, 16, 16, 16, 12, 12, 8, 0} - log.Info(standardTableSize10(sizes, args)) + log.Info(cobol.TerminalChomp(standardTableSize10(sizes, args))) all := allr.SortByFullPath() for all.Scan() { @@ -102,13 +102,13 @@ func (f *Forge) PrintHumanTableDirty(allr *gitpb.Repos) { // print the header args := []string{"namespace", "cur br", "age", "master", "devel", "user", "curver", "lasttag", "next", "repo type"} sizes := []int{40, 12, 6, 12, 16, 16, 16, 12, 12, 8} - log.Info(standardTableSize10(sizes, args)) + log.Info(cobol.TerminalChomp(standardTableSize10(sizes, args))) for repo := range allr.IterAll() { f.printRepoToTable(repo, sizes, false) if len(repo.DirtyList) != 0 { for _, line := range repo.DirtyList { - log.Info("\t", line) + log.Info(cobol.TerminalChomp("\t" + line)) } } var mver string = repo.GetMasterVersion() @@ -177,15 +177,6 @@ func standardTable5(arg1, arg2, arg3, arg4, arg5 string) string { return fmt.Sprintf(s, arg1, arg2, arg3, arg4, arg5) } -/* -func standardTable10(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10 string) string { - args := []string{arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10} - sizes := []int{40, 12, 6, 12, 16, 16, 16, 12, 12, 8} - - return standardTableSize10(sizes, args) -} -*/ - func standardTableSize10(sizes []int, args []string) string { var s string for i, si := range sizes { @@ -294,7 +285,7 @@ func (f *Forge) printRepoToTable(repo *gitpb.Repo, sizes []int, full bool) { end += "(" + repo.GetState() + ") " } - log.Info(start, end) + log.Info(cobol.TerminalChomp(start + " " + end)) } func (f *Forge) printForgedToTable(repo *gitpb.Repo, sizes []int) { @@ -320,7 +311,7 @@ func (f *Forge) printForgedToTable(repo *gitpb.Repo, sizes []int) { end += "todo" - log.Info(start, end) + log.Info(cobol.TerminalChomp(start + " " + end)) } func (psets *Patchsets) PrintTable() { @@ -332,7 +323,7 @@ func (psets *Patchsets) PrintTable() { // print the header args := []string{"commit hash", "new hash", "", "", "name", "Repo Namespace", "", "", "", "", ""} sizes := []int{12, 12, 3, 3, 40, 80, 2, 2, 2, 2} - log.Info(cobol.StandardTableSize10(sizes, args)) + log.Info(cobol.TerminalChomp(standardTableSize10(sizes, args))) var countCONTENTS int var countPARTS int @@ -348,7 +339,7 @@ func (psets *Patchsets) PrintTable() { args = []string{p.CommitHash, p.NewHash, cId, partId, fname, p.GetNamespace(), "", "", "", "", ""} start := cobol.StandardTableSize10(sizes, args) - cobol.TerminalCut(start) + log.Info(cobol.TerminalChomp(start)) countPARTS += 1 } }