diff options
Diffstat (limited to 'tablePB.go')
| -rw-r--r-- | tablePB.go | 35 |
1 files changed, 24 insertions, 11 deletions
@@ -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 } |
