From 4d923f942fa406b253d5414e0b8d39a3a6012c18 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 26 Sep 2025 01:19:31 -0500 Subject: add PB table row debug() --- humanTable.go | 12 +++++++++++- tablePB.go | 3 +-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/humanTable.go b/humanTable.go index 6c94a60..6c0e803 100644 --- a/humanTable.go +++ b/humanTable.go @@ -22,7 +22,7 @@ func StandardTableRow(sizes []int, args []string) (string, string) { var cell string var sfmt string if si < 0 { - sfmt = "%-s" + sfmt = "%-80s" } else if si == 0 { sfmt = "%-8.8s" } else { @@ -50,6 +50,16 @@ func StandardTableRow(sizes []int, args []string) (string, string) { return line[0:small], strings.Join(fmts, " ") } +func StandardTableRowDebug(sizes []int, args []string) (string, string) { + for i, si := range sizes { + if len(args) > i { + args[i] = fmt.Sprintf("(%d)%s", si, args[i]) + // cell = fmt.Sprintf(sfmt, val) + } + } + return StandardTableRow(sizes, args) +} + func StandardTableSize5(sizes []int, args []string) string { WIDTH, _ := getTerminalWidth() var s string diff --git a/tablePB.go b/tablePB.go index 6348797..8d55313 100644 --- a/tablePB.go +++ b/tablePB.go @@ -46,8 +46,7 @@ func PrintTable(pb *guipb.Table) { sizes = append(sizes, int(attr.Width)) } } - // sizes = []int{24, 5, 8, 32, 13, 4, 4, 4, 4} - header, _ := StandardTableRow(sizes, args) + header, _ := StandardTableRowDebug(sizes, args) log.Info(header) for i := range HEIGHT { -- cgit v1.2.3