summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tablePB.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/tablePB.go b/tablePB.go
index 2cf42b0..cb06bfb 100644
--- a/tablePB.go
+++ b/tablePB.go
@@ -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
+ }
}
}