summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarlos Alexandro Becker <caarlos0@users.noreply.github.com>2024-11-15 13:44:51 -0300
committerCarlos Alexandro Becker <caarlos0@users.noreply.github.com>2024-11-15 13:44:51 -0300
commitab9e24177942f4630609b0432f4389cc4f6ec6db (patch)
tree1db192ccd34dd7af5d7c03d400b91f1b99cb7de2
parentc3ce2f97bf98b2d49aac244c10cc25a07aada578 (diff)
fix(table): only set height if > 0table-height
closes #685 closes #660
-rw-r--r--table/command.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/table/command.go b/table/command.go
index 1e08faf..6f9aca9 100644
--- a/table/command.go
+++ b/table/command.go
@@ -102,13 +102,16 @@ func (o Options) Run() error {
return nil
}
- table := table.New(
+ opts := []table.Option{
table.WithColumns(columns),
table.WithFocused(true),
- table.WithHeight(o.Height),
table.WithRows(rows),
table.WithStyles(styles),
- )
+ }
+ if o.Height > 0 {
+ opts = append(opts, table.WithHeight(o.Height))
+ }
+ table := table.New(opts...)
tm, err := tea.NewProgram(model{table: table}, tea.WithOutput(os.Stderr)).Run()
if err != nil {