diff --git a/core/core/list.go b/core/core/list.go index 111f3ef4..b9f61449 100644 --- a/core/core/list.go +++ b/core/core/list.go @@ -96,6 +96,8 @@ func prettyPrintListFormat(ctx context.Context, targetPolicy string, policies [] policyTable.SetHeader([]string{header}) policyTable.SetHeaderLine(true) policyTable.SetRowLine(true) + policyTable.SetHeaderAlignment(tablewriter.ALIGN_LEFT) + policyTable.SetAutoFormatHeaders(false) policyTable.SetAlignment(tablewriter.ALIGN_CENTER) policyTable.SetUnicodeHVC(tablewriter.Regular, tablewriter.Regular, gchalk.Ansi256(238)) data := v2.Matrix{} @@ -126,6 +128,8 @@ func prettyPrintControls(ctx context.Context, policies []string) { controlsTable.SetAutoWrapText(false) controlsTable.SetHeaderLine(true) controlsTable.SetRowLine(true) + controlsTable.SetHeaderAlignment(tablewriter.ALIGN_LEFT) + controlsTable.SetAutoFormatHeaders(false) controlsTable.SetUnicodeHVC(tablewriter.Regular, tablewriter.Regular, gchalk.Ansi256(238)) controlRows := generateControlRows(policies) diff --git a/core/pkg/resultshandling/printer/v2/controltable.go b/core/pkg/resultshandling/printer/v2/controltable.go index e7511f80..d19987d3 100644 --- a/core/pkg/resultshandling/printer/v2/controltable.go +++ b/core/pkg/resultshandling/printer/v2/controltable.go @@ -141,14 +141,14 @@ func getControlTableHeaders(short bool) []string { var headers []string if short { headers = make([]string, 1) - headers[0] = "CONTROLS" + headers[0] = "Controls" } else { headers = make([]string, _rowLen) - headers[columnName] = "CONTROL NAME" - headers[columnCounterFailed] = "FAILED RESOURCES" - headers[columnCounterAll] = "ALL RESOURCES" - headers[columnSeverity] = "SEVERITY" - headers[columnComplianceScore] = "% COMPLIANCE-SCORE" + headers[columnName] = "Control Name" + headers[columnCounterFailed] = "Failed Resources" + headers[columnCounterAll] = "All Resources" + headers[columnSeverity] = "Severity" + headers[columnComplianceScore] = "% Compliane-Score" } return headers } diff --git a/core/pkg/resultshandling/printer/v2/prettyprinter/tableprinter/configurationprinter/categorytable.go b/core/pkg/resultshandling/printer/v2/prettyprinter/tableprinter/configurationprinter/categorytable.go index e7bb985c..fc191026 100644 --- a/core/pkg/resultshandling/printer/v2/prettyprinter/tableprinter/configurationprinter/categorytable.go +++ b/core/pkg/resultshandling/printer/v2/prettyprinter/tableprinter/configurationprinter/categorytable.go @@ -13,11 +13,11 @@ import ( const ( docsPrefix = "https://hub.armosec.io/docs" scanControlPrefix = "$ kubescape scan control" - controlNameHeader = "CONTROL NAME" + controlNameHeader = "Control Name" statusHeader = "" - docsHeader = "DOCS" - resourcesHeader = "RESOURCES" - runHeader = "VIEW DETAILS" + docsHeader = "Docs" + resourcesHeader = "Resources" + runHeader = "View Details" ) // initializes the table headers and column alignments based on the category type @@ -84,6 +84,8 @@ func getCategoryTableWriter(writer io.Writer, headers []string, columnAligments table := tablewriter.NewWriter(writer) table.SetHeader(headers) table.SetHeaderLine(true) + table.SetHeaderAlignment(tablewriter.ALIGN_LEFT) + table.SetAutoFormatHeaders(false) table.SetColumnAlignment(columnAligments) table.SetAutoWrapText(false) table.SetUnicodeHVC(tablewriter.Regular, tablewriter.Regular, gchalk.Ansi256(238)) diff --git a/core/pkg/resultshandling/printer/v2/prettyprinter/tableprinter/configurationprinter/categorytable_test.go b/core/pkg/resultshandling/printer/v2/prettyprinter/tableprinter/configurationprinter/categorytable_test.go index 6d4b69df..5421c852 100644 --- a/core/pkg/resultshandling/printer/v2/prettyprinter/tableprinter/configurationprinter/categorytable_test.go +++ b/core/pkg/resultshandling/printer/v2/prettyprinter/tableprinter/configurationprinter/categorytable_test.go @@ -21,13 +21,13 @@ func TestInitCategoryTableData(t *testing.T) { { name: "Test1", categoryType: TypeCounting, - expectedHeaders: []string{"CONTROL NAME", "RESOURCES", "VIEW DETAILS"}, + expectedHeaders: []string{"Control Name", "Resources", "View Details"}, expectedAlignments: []int{tablewriter.ALIGN_LEFT, tablewriter.ALIGN_CENTER, tablewriter.ALIGN_LEFT}, }, { name: "Test2", categoryType: TypeStatus, - expectedHeaders: []string{"", "CONTROL NAME", "DOCS"}, + expectedHeaders: []string{"", "Control Name", "Docs"}, expectedAlignments: []int{tablewriter.ALIGN_CENTER, tablewriter.ALIGN_LEFT, tablewriter.ALIGN_CENTER}, }, } diff --git a/core/pkg/resultshandling/printer/v2/prettyprinter/tableprinter/configurationprinter/frameworkscan.go b/core/pkg/resultshandling/printer/v2/prettyprinter/tableprinter/configurationprinter/frameworkscan.go index 1cacde53..9abc5cc4 100644 --- a/core/pkg/resultshandling/printer/v2/prettyprinter/tableprinter/configurationprinter/frameworkscan.go +++ b/core/pkg/resultshandling/printer/v2/prettyprinter/tableprinter/configurationprinter/frameworkscan.go @@ -40,6 +40,8 @@ func (fp *FrameworkPrinter) PrintSummaryTable(writer io.Writer, summaryDetails * summaryTable.SetAutoWrapText(false) summaryTable.SetHeaderLine(true) + summaryTable.SetHeaderAlignment(tablewriter.ALIGN_LEFT) + summaryTable.SetAutoFormatHeaders(false) summaryTable.SetColumnAlignment(GetColumnsAlignments()) summaryTable.SetUnicodeHVC(tablewriter.Regular, tablewriter.Regular, gchalk.Ansi256(238)) diff --git a/core/pkg/resultshandling/printer/v2/prettyprinter/tableprinter/configurationprinter/summarytable.go b/core/pkg/resultshandling/printer/v2/prettyprinter/tableprinter/configurationprinter/summarytable.go index c88a6500..38d6ea54 100644 --- a/core/pkg/resultshandling/printer/v2/prettyprinter/tableprinter/configurationprinter/summarytable.go +++ b/core/pkg/resultshandling/printer/v2/prettyprinter/tableprinter/configurationprinter/summarytable.go @@ -32,14 +32,14 @@ func GetControlTableHeaders(short bool) []string { var headers []string if short { headers = make([]string, 1) - headers[0] = "CONTROLS" + headers[0] = "Controls" } else { headers = make([]string, _summaryRowLen) - headers[summaryColumnName] = "CONTROL NAME" - headers[summaryColumnCounterFailed] = "FAILED RESOURCES" - headers[summaryColumnCounterAll] = "ALL RESOURCES" - headers[summaryColumnSeverity] = "SEVERITY" - headers[summaryColumnComplianceScore] = "% COMPLIANCE-SCORE" + headers[summaryColumnName] = "Control Name" + headers[summaryColumnCounterFailed] = "Failed Resources" + headers[summaryColumnCounterAll] = "All Resources" + headers[summaryColumnSeverity] = "Severity" + headers[summaryColumnComplianceScore] = "% Compliance-Score" } return headers } diff --git a/core/pkg/resultshandling/printer/v2/prettyprinter/tableprinter/configurationprinter/workloadscan_test.go b/core/pkg/resultshandling/printer/v2/prettyprinter/tableprinter/configurationprinter/workloadscan_test.go index ccf10deb..3fb622ef 100644 --- a/core/pkg/resultshandling/printer/v2/prettyprinter/tableprinter/configurationprinter/workloadscan_test.go +++ b/core/pkg/resultshandling/printer/v2/prettyprinter/tableprinter/configurationprinter/workloadscan_test.go @@ -8,7 +8,7 @@ import ( func TestWorkloadScan_InitCategoryTableData(t *testing.T) { - expectedHeader := []string{"", "CONTROL NAME", "DOCS"} + expectedHeader := []string{"", "Control Name", "Docs"} expectedAlign := []int{tablewriter.ALIGN_CENTER, tablewriter.ALIGN_LEFT, tablewriter.ALIGN_CENTER} workloadPrinter := NewWorkloadPrinter() diff --git a/core/pkg/resultshandling/printer/v2/prettyprinter/tableprinter/imageprinter/utils.go b/core/pkg/resultshandling/printer/v2/prettyprinter/tableprinter/imageprinter/utils.go index f3843180..7fe0d2e5 100644 --- a/core/pkg/resultshandling/printer/v2/prettyprinter/tableprinter/imageprinter/utils.go +++ b/core/pkg/resultshandling/printer/v2/prettyprinter/tableprinter/imageprinter/utils.go @@ -15,6 +15,8 @@ func renderTable(writer io.Writer, headers []string, columnAlignments []int, row table := tablewriter.NewWriter(writer) table.SetHeader(headers) table.SetHeaderLine(true) + table.SetHeaderAlignment(tablewriter.ALIGN_LEFT) + table.SetAutoFormatHeaders(false) table.SetColumnAlignment(columnAlignments) table.SetUnicodeHVC(tablewriter.Regular, tablewriter.Regular, gchalk.Ansi256(238)) @@ -64,11 +66,11 @@ func generateRow(cve CVE) []string { func getImageScanningHeaders() []string { headers := make([]string, 5) - headers[imageColumnSeverity] = "SEVERITY" - headers[imageColumnName] = "VULNERABILITY" - headers[imageColumnComponent] = "COMPONENT" - headers[imageColumnVersion] = "VERSION" - headers[imageColumnFixedIn] = "FIXED IN" + headers[imageColumnSeverity] = "Severity" + headers[imageColumnName] = "Vulnerability" + headers[imageColumnComponent] = "Component" + headers[imageColumnVersion] = "Version" + headers[imageColumnFixedIn] = "Fixed In" return headers } diff --git a/core/pkg/resultshandling/printer/v2/prettyprinter/tableprinter/imageprinter/utils_test.go b/core/pkg/resultshandling/printer/v2/prettyprinter/tableprinter/imageprinter/utils_test.go index c23b9424..e2315f47 100644 --- a/core/pkg/resultshandling/printer/v2/prettyprinter/tableprinter/imageprinter/utils_test.go +++ b/core/pkg/resultshandling/printer/v2/prettyprinter/tableprinter/imageprinter/utils_test.go @@ -140,7 +140,7 @@ func TestGenerateRow(t *testing.T) { func TestGetImageScanningHeaders(t *testing.T) { headers := getImageScanningHeaders() - expectedHeaders := []string{"SEVERITY", "VULNERABILITY", "COMPONENT", "VERSION", "FIXED IN"} + expectedHeaders := []string{"Severity", "Vulnerability", "Component", "Version", "Fixed In"} for i := range headers { if headers[i] != expectedHeaders[i] { diff --git a/core/pkg/resultshandling/printer/v2/resourcetable.go b/core/pkg/resultshandling/printer/v2/resourcetable.go index ad5355ab..0bd5882c 100644 --- a/core/pkg/resultshandling/printer/v2/resourcetable.go +++ b/core/pkg/resultshandling/printer/v2/resourcetable.go @@ -51,6 +51,8 @@ func (prettyPrinter *PrettyPrinter) resourceTable(opaSessionObj *cautils.OPASess summaryTable.SetAutoMergeCells(true) summaryTable.SetHeaderLine(true) summaryTable.SetRowLine(true) + summaryTable.SetHeaderAlignment(tablewriter.ALIGN_LEFT) + summaryTable.SetAutoFormatHeaders(false) summaryTable.SetUnicodeHVC(tablewriter.Regular, tablewriter.Regular, gchalk.Ansi256(238)) resourceRows := [][]string{}