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/utils/output/table/printer.go
Charles-Edouard Brétéché 9bc540e454
feat: add table output to cli apply command (#7757)
* feat: add table output to cli apply command

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* factorise

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

---------

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Co-authored-by: shuting <shuting@nirmata.com>
2023-07-06 11:48:19 +00:00

23 lines
644 B
Go

package table
import (
"os"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/utils/color"
"github.com/lensesio/tableprinter"
)
func NewTablePrinter() *tableprinter.Printer {
printer := tableprinter.New(os.Stdout)
printer.BorderTop, printer.BorderBottom, printer.BorderLeft, printer.BorderRight = true, true, true, true
printer.CenterSeparator = "│"
printer.ColumnSeparator = "│"
printer.RowSeparator = "─"
printer.RowCharLimit = 300
printer.HeaderBgColor = color.HeaderBgColor
printer.HeaderFgColor = color.HeaderFgColor
printer.RowLengthTitle = func(rowsLength int) bool {
return rowsLength > 10
}
return printer
}