diff options
| author | Jeff Carr <[email protected]> | 2025-09-26 01:19:31 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-09-26 02:20:56 -0500 |
| commit | 4d923f942fa406b253d5414e0b8d39a3a6012c18 (patch) | |
| tree | eebaef7875efaa668ee18d255befbfb21d75826a | |
| parent | a23bb99c39b4a540627fdcc69cf2d58560f3445d (diff) | |
add PB table row debug()v0.0.9
| -rw-r--r-- | humanTable.go | 12 | ||||
| -rw-r--r-- | 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 @@ -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 { |
