diff options
Diffstat (limited to 'tablePB.go')
| -rw-r--r-- | tablePB.go | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -13,6 +13,11 @@ import ( ) func PrintTable(pb *guipb.Table) { + PrintTableLimit(pb, -1) +} + +// limits the number of out lines +func PrintTableLimit(pb *guipb.Table, limit int) { // fmt.Info("print PB here") if pb.Grid == nil { @@ -42,6 +47,7 @@ func PrintTable(pb *guipb.Table) { header, _ := StandardTableRow(sizes, args) fmt.Println(header) + var counter int // now print the table rows for i := range len(pb.AnyCols[0].Vals) { var cells []string @@ -57,6 +63,13 @@ func PrintTable(pb *guipb.Table) { line += "FMT: " + fmtline } fmt.Println(line) + if limit < 0 { + continue + } + counter += 1 + if counter > limit { + break + } } } |
