summaryrefslogtreecommitdiff
path: root/tablePB.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-30 14:03:30 -0500
committerJeff Carr <[email protected]>2025-10-30 14:03:30 -0500
commit357b464107b520fae4ed064b3dac639b14105e1a (patch)
tree78785aa9dec34de85392363acd29a37abe6fdb32 /tablePB.go
parent57fa0dc00c8141c252c8ec452f8a34448315c33d (diff)
wasn't cleaning out newlines in row dataHEADv0.0.34v0.0.33masterdevel
Diffstat (limited to 'tablePB.go')
-rw-r--r--tablePB.go35
1 files changed, 24 insertions, 11 deletions
diff --git a/tablePB.go b/tablePB.go
index edfaacb..7272f01 100644
--- a/tablePB.go
+++ b/tablePB.go
@@ -13,17 +13,21 @@ import (
)
func PrintTable(pb *guipb.Table) {
- PrintTableLimit(pb, -1)
+ PrintTableLimit(pb, -1, false)
+}
+
+func PrintTableDebug(pb *guipb.Table) {
+ PrintTableLimit(pb, -1, true)
}
// limits the number of out lines
-func PrintTableLimit(pb *guipb.Table, limit int) {
- // fmt.Info("print PB here")
+func PrintTableLimit(pb *guipb.Table, limit int, debug bool) {
+ // fmt.Println("print PB here")
if pb.Grid == nil {
- // fmt.Info("grid = nil")
+ // fmt.Println("grid = nil")
} else {
- // fmt.Info("grid.Id =", pb.Grid.Id)
+ // fmt.Println("grid.Id =", pb.Grid.Id)
}
if cursize, ok := getTerminalWidth(); ok {
TERMSIZE = cursize
@@ -32,7 +36,7 @@ func PrintTableLimit(pb *guipb.Table, limit int) {
var args []string
var sizes []int
- // fmt.Info("INFO: table len=", len(pb.AnyCols))
+ // fmt.Println("INFO: table len=", len(pb.AnyCols))
// first print the table header
for _, col := range pb.AnyCols {
args = append(args, col.Header.Name)
@@ -42,10 +46,13 @@ func PrintTableLimit(pb *guipb.Table, limit int) {
sizes = append(sizes, int(col.Attr.Width))
}
}
- // header, _ := StandardTableRowDebug(sizes, args)
- // fmt.Info(header)
- header, _ := StandardTableRow(sizes, args)
- fmt.Println(header)
+ if debug {
+ header, _ := StandardTableRowDebug(sizes, args)
+ fmt.Println(header)
+ } else {
+ header, _ := StandardTableRow(sizes, args)
+ fmt.Println(header)
+ }
var counter int
// now print the table rows
@@ -59,7 +66,13 @@ func PrintTableLimit(pb *guipb.Table, limit int) {
fmt.Println("cobol TABLE CELL FAILED", col.Header.Name, i, val, ok)
}
}
- line, fmtline := StandardTableRow(sizes, cells)
+ var line string
+ var fmtline string
+ if debug {
+ line, fmtline = StandardTableRowDebug(sizes, cells)
+ } else {
+ line, fmtline = StandardTableRow(sizes, cells)
+ }
if os.Getenv("TABLEPB_VERBOSE") == "true" {
line += "FMT: " + fmtline
}