1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-06 07:57:07 +00:00
kyverno/cmd/cli/kubectl-kyverno/output/table/table.go
Charles-Edouard Brétéché b2d29886c1
chore: improve unit tests in cli (#8301)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-07 02:53:37 +00:00

28 lines
468 B
Go

package table
type Table struct {
RawRows []Row
}
func (t *Table) AddFailed(rows ...Row) {
for _, row := range rows {
if row.IsFailure {
t.RawRows = append(t.RawRows, row)
}
}
}
func (t *Table) Add(rows ...Row) {
t.RawRows = append(t.RawRows, rows...)
}
func (t *Table) Rows(detailed bool) interface{} {
if detailed {
return t.RawRows
}
var rows []RowCompact
for _, row := range t.RawRows {
rows = append(rows, row.RowCompact)
}
return rows
}