1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-10 01:46:55 +00:00
kyverno/cmd/cli/kubectl-kyverno/output/table/table.go

29 lines
492 B
Go
Raw Normal View History

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
}
rows := make([]RowCompact, 0, len(t.RawRows))
for _, row := range t.RawRows {
rows = append(rows, row.RowCompact)
}
return rows
}