diff options
| -rw-r--r-- | humanTable.go | 66 | ||||
| -rw-r--r-- | set.table.go | 21 |
2 files changed, 16 insertions, 71 deletions
diff --git a/humanTable.go b/humanTable.go index 2bbeda7..b476d74 100644 --- a/humanTable.go +++ b/humanTable.go @@ -245,69 +245,3 @@ func (f *Forge) printForgedToTable(repo *gitpb.Repo, sizes []int) { log.Info(cobol.TerminalChomp(start + " " + end)) } - -func (psets *Sets) PrintTable() { - if psets == nil { - return - } - log.DaemonMode(true) - - // 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(cobol.StandardTableSize10(sizes, args))) - - /* - var countCONTENTS int - var countPARTS int - for x, pset := range psets.GetSets() { - log.Info(pset.Patches.Uuid, pset.Patches.Name, pset.Patches.State) - if pset.State == "DONE" { - // old patchset - continue - } - cId := log.Sprintf("%d", x) - countCONTENTS += 1 - for i, p := range pset.Patches.GetPatches() { - var args []string - partId := log.Sprintf("%d", i) - - _, fname := filepath.Split(p.GetFilename()) - args = []string{p.CommitHash, p.NewHash, cId, partId, fname, p.GetNamespace(), "", "", "", "", ""} - - start := cobol.StandardTableSize10(sizes, args) - log.Info(cobol.TerminalChomp(start)) - countPARTS += 1 - } - } - log.Infof("Total Contents (%d) Parts (%d)\n", countCONTENTS, countPARTS) - */ -} - -func (patches *Patches) PrintTable() { - if patches == nil { - return - } - log.DaemonMode(true) - - // 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(cobol.StandardTableSize10(sizes, args))) - - /* - var countPARTS int - for x, p := range patches.GetPatches() { - var args []string - partId := log.Sprintf("%d", x) - - _, fname := filepath.Split(p.GetFilename()) - args = []string{p.CommitHash, p.NewHash, partId, fname, p.GetNamespace(), "", "", "", "", ""} - - start := cobol.StandardTableSize10(sizes, args) - log.Info(cobol.TerminalChomp(start)) - countPARTS += 1 - } - log.Infof("Total Patches (%d)\n", countPARTS) - */ -} diff --git a/set.table.go b/set.table.go index 1ab2526..5bc2cb1 100644 --- a/set.table.go +++ b/set.table.go @@ -5,7 +5,6 @@ package forgepb import ( "time" - "go.wit.com/lib/cobol" "go.wit.com/log" ) @@ -20,10 +19,22 @@ func (pset *Set) PrintTable() { tablePB.PrintTable() } -func (mt *PatchesTable) PrintTable() { - // log.Info("ShowTable() SENDING TO GUI") - mt.MakeTable() - cobol.PrintTable(mt.pb) +func (pb *Sets) PrintTable() { + for pset := range pb.IterAll() { + if pset.Patches == nil { + continue + } + tablePB := pset.Patches.makeStandardTable() + tablePB.MakeTable() + tablePB.PrintTable() + } +} + +func (pb *Patches) PrintTable() { + log.DaemonMode(true) // don't timestamp lines + + tablePB := pb.makeStandardTable() + tablePB.PrintTable() } func (pb *Patches) makeStandardTable() *PatchesTable { |
