summaryrefslogtreecommitdiff
path: root/humanTable.go
diff options
context:
space:
mode:
Diffstat (limited to 'humanTable.go')
-rw-r--r--humanTable.go30
1 files changed, 22 insertions, 8 deletions
diff --git a/humanTable.go b/humanTable.go
index 612e789..d70baf1 100644
--- a/humanTable.go
+++ b/humanTable.go
@@ -3,7 +3,6 @@
package forgepb
import (
- "fmt"
"path/filepath"
"go.wit.com/lib/cobol"
@@ -44,7 +43,7 @@ func (f *Forge) PrintHumanTable(allr *gitpb.Repos) {
// print the header
args := []string{"namespace", "cur br", "age", "master", "devel", "user", "", "lasttag", "next", "repo type"}
sizes := []int{40, 9, 6, 16, 16, 16, 1, 12, 12, 8}
- log.Info(cobol.TerminalChomp(standardTableSize10(sizes, args)))
+ log.Info(cobol.TerminalChomp(cobol.StandardTableSize10(sizes, args)))
all := allr.SortByFullPath()
for all.Scan() {
@@ -63,7 +62,7 @@ func (f *Forge) PrintForgedTable(allr *gitpb.Repos) {
// print the header
args := []string{"namespace", "cur br", "age", "master", "devel", "last tag", "", "", "", ""}
sizes := []int{40, 9, 6, 12, 16, 16, 16, 12, 12, 8}
- log.Info(cobol.TerminalChomp(standardTableSize10(sizes, args)))
+ log.Info(cobol.TerminalChomp(cobol.StandardTableSize10(sizes, args)))
all := allr.SortByFullPath()
for all.Scan() {
@@ -82,7 +81,7 @@ func (f *Forge) PrintHumanTableFull(allr *gitpb.Repos) {
// print the header
args := []string{"cur br", "age", "master", "devel", "user", "", "lasttag", "next", "repo type", "namespace"}
sizes := []int{9, 6, 16, 16, 16, 1, 12, 12, 8, 0}
- log.Info(cobol.TerminalChomp(standardTableSize10(sizes, args)))
+ log.Info(cobol.TerminalChomp(cobol.StandardTableSize10(sizes, args)))
all := allr.SortByFullPath()
for all.Scan() {
@@ -102,7 +101,7 @@ func (f *Forge) PrintHumanTableDirty(allr *gitpb.Repos) {
// print the header
args := []string{"namespace", "cur br", "age", "master", "devel", "user", "", "lasttag", "next", "repo type"}
sizes := []int{40, 9, 6, 16, 16, 16, 1, 12, 12, 8}
- log.Info(cobol.TerminalChomp(standardTableSize10(sizes, args)))
+ log.Info(cobol.TerminalChomp(cobol.StandardTableSize10(sizes, args)))
for repo := range allr.IterAll() {
f.printRepoToTable(repo, sizes, false)
@@ -147,6 +146,7 @@ func tallyBranchTotals(t *tally, repo *gitpb.Repo) {
t.unknown += 1
}
+/*
func standardTable5(arg1, arg2, arg3, arg4, arg5 string) string {
len1 := 40
len2 := 12
@@ -176,7 +176,9 @@ func standardTable5(arg1, arg2, arg3, arg4, arg5 string) string {
s += "%-" + fmt.Sprintf("%d", len5) + "s"
return fmt.Sprintf(s, arg1, arg2, arg3, arg4, arg5)
}
+*/
+/*
func standardTableSize10(sizes []int, args []string) string {
var s string
for i, si := range sizes {
@@ -204,6 +206,7 @@ func standardTableSize10(sizes []int, args []string) string {
return fmt.Sprintf(s, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10)
// return fmt.Sprintf(s, args)
}
+*/
func (f *Forge) printRepoToTable(repo *gitpb.Repo, sizes []int, full bool) {
var end string
@@ -226,6 +229,17 @@ func (f *Forge) printRepoToTable(repo *gitpb.Repo, sizes []int, full bool) {
gopath = repo.GetFullPath()
}
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"
+ }
// ctime := repo.Tags.GetAge(mhort)
// age := shell.FormatDuration(time.Since(ctime))
@@ -248,7 +262,7 @@ func (f *Forge) printRepoToTable(repo *gitpb.Repo, sizes []int, full bool) {
} else {
args = []string{gopath, cname, age, mhort, dhort, uhort, chort, lasttag, thort, rtype}
}
- start := standardTableSize10(sizes, args)
+ start := cobol.StandardTableSize10(sizes, args)
if rtype == "protobuf" {
if repo.GoInfo.GoBinary {
@@ -307,7 +321,7 @@ func (f *Forge) printForgedToTable(repo *gitpb.Repo, sizes []int) {
var args []string
args = []string{ns, cname, age, mhort, dhort, lasttag, "", "", "", ""}
- start := standardTableSize10(sizes, args)
+ start := cobol.StandardTableSize10(sizes, args)
end += "todo"
@@ -323,7 +337,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.TerminalChomp(standardTableSize10(sizes, args)))
+ log.Info(cobol.TerminalChomp(cobol.StandardTableSize10(sizes, args)))
var countCONTENTS int
var countPARTS int