summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--humanTable.go4
-rw-r--r--tablePB.go7
-rw-r--r--termSize.go1
3 files changed, 9 insertions, 3 deletions
diff --git a/humanTable.go b/humanTable.go
index 6c0e803..295478d 100644
--- a/humanTable.go
+++ b/humanTable.go
@@ -42,8 +42,8 @@ func StandardTableRow(sizes []int, args []string) (string, string) {
line := strings.Join(parts, " ")
var small int
- if len(line) > WIDTH {
- small = WIDTH
+ if len(line) > TERMSIZE {
+ small = TERMSIZE
} else {
small = len(line) - 3
}
diff --git a/tablePB.go b/tablePB.go
index 8d55313..ab1f74a 100644
--- a/tablePB.go
+++ b/tablePB.go
@@ -23,6 +23,9 @@ func PrintTable(pb *guipb.Table) {
} else {
// log.Info("grid.Id =", pb.Grid.Id)
}
+ if cursize, ok := getTerminalWidth(); ok {
+ TERMSIZE = cursize
+ }
var h int = 0
var w int = 0
@@ -46,7 +49,9 @@ func PrintTable(pb *guipb.Table) {
sizes = append(sizes, int(attr.Width))
}
}
- header, _ := StandardTableRowDebug(sizes, args)
+ // header, _ := StandardTableRowDebug(sizes, args)
+ // log.Info(header)
+ header, _ := StandardTableRow(sizes, args)
log.Info(header)
for i := range HEIGHT {
diff --git a/termSize.go b/termSize.go
index cc9d5af..85594e0 100644
--- a/termSize.go
+++ b/termSize.go
@@ -10,6 +10,7 @@ import (
)
var WIDTH int = 120
+var TERMSIZE int = 80
// getTerminalWidth returns the width of the active terminal.
// If the output is not an interactive terminal (e.g., it's being piped to a file