From 99bf703997699854a05cc747e61d8369c99b33ac Mon Sep 17 00:00:00 2001 From: Thomas von Dein Date: Wed, 8 Jul 2026 14:57:46 +0200 Subject: [PATCH] add table.AddRowLate() to add rows after sorting --- pkg/printer/table.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pkg/printer/table.go b/pkg/printer/table.go index fd40b36..cf412d4 100644 --- a/pkg/printer/table.go +++ b/pkg/printer/table.go @@ -206,6 +206,22 @@ func (table *Table) AddRow(fields ...any) { table.Entries = append(table.Entries, fields) } +func (table *Table) AddRowLate(fields ...any) { + table.AddRow(fields) + + if !table.processed { + return + } + + row := make([]string, len(fields)) + + for idx, field := range fields { + row[idx] = any2string(field) + } + + table.rows = append(table.rows, row) +} + // needed for json and yaml output func (table *Table) toMap() []map[string]any { raw := make([]map[string]any, len(table.Entries))