mirror of
https://github.com/kubescape/kubescape.git
synced 2026-02-14 18:09:55 +00:00
feat: add table heading colors (#1321)
Signed-off-by: DRAGON <anantvijay3@gmail.com>
This commit is contained in:
@@ -100,6 +100,13 @@ func prettyPrintListFormat(ctx context.Context, targetPolicy string, policies []
|
||||
data := v2.Matrix{}
|
||||
|
||||
controlRows := generatePolicyRows(policies)
|
||||
|
||||
var headerColors []tablewriter.Colors
|
||||
for range controlRows[0] {
|
||||
headerColors = append(headerColors, tablewriter.Colors{tablewriter.Bold, tablewriter.FgHiYellowColor})
|
||||
}
|
||||
policyTable.SetHeaderColor(headerColors...)
|
||||
|
||||
data = append(data, controlRows...)
|
||||
|
||||
policyTable.AppendBulk(data)
|
||||
@@ -130,6 +137,11 @@ func prettyPrintControls(ctx context.Context, policies []string) {
|
||||
} else {
|
||||
controlsTable.SetHeader([]string{"Control ID", "Control Name", "Docs", "Frameworks"})
|
||||
}
|
||||
var headerColors []tablewriter.Colors
|
||||
for range controlRows[0] {
|
||||
headerColors = append(headerColors, tablewriter.Colors{tablewriter.Bold, tablewriter.FgHiYellowColor})
|
||||
}
|
||||
controlsTable.SetHeaderColor(headerColors...)
|
||||
|
||||
data := v2.Matrix{}
|
||||
data = append(data, controlRows...)
|
||||
|
||||
@@ -97,6 +97,11 @@ func getCategoryTableWriter(writer io.Writer, headers []string, columnAligments
|
||||
table.SetColumnAlignment(columnAligments)
|
||||
table.SetAutoWrapText(false)
|
||||
table.SetUnicodeHV(tablewriter.Regular, tablewriter.Regular)
|
||||
var headerColors []tablewriter.Colors
|
||||
for range headers {
|
||||
headerColors = append(headerColors, tablewriter.Colors{tablewriter.Bold, tablewriter.FgHiYellowColor})
|
||||
}
|
||||
table.SetHeaderColor(headerColors...)
|
||||
return table
|
||||
}
|
||||
|
||||
|
||||
@@ -70,6 +70,12 @@ func (fp *FrameworkPrinter) PrintSummaryTable(writer io.Writer, summaryDetails *
|
||||
summaryTable.SetHeader(GetControlTableHeaders(short))
|
||||
summaryTable.SetFooter(GenerateFooter(summaryDetails, short))
|
||||
|
||||
var headerColors []tablewriter.Colors
|
||||
for range dataRows[0] {
|
||||
headerColors = append(headerColors, tablewriter.Colors{tablewriter.Bold, tablewriter.FgHiYellowColor})
|
||||
}
|
||||
summaryTable.SetHeaderColor(headerColors...)
|
||||
|
||||
summaryTable.AppendBulk(dataRows)
|
||||
summaryTable.Render()
|
||||
|
||||
|
||||
@@ -19,6 +19,12 @@ func renderTable(writer io.Writer, headers []string, columnAlignments []int, row
|
||||
table.SetColumnAlignment(columnAlignments)
|
||||
table.SetUnicodeHV(tablewriter.Regular, tablewriter.Regular)
|
||||
|
||||
var headerColors []tablewriter.Colors
|
||||
for range rows[0] {
|
||||
headerColors = append(headerColors, tablewriter.Colors{tablewriter.Bold, tablewriter.FgHiYellowColor})
|
||||
}
|
||||
table.SetHeaderColor(headerColors...)
|
||||
|
||||
table.AppendBulk(rows)
|
||||
|
||||
table.Render()
|
||||
|
||||
@@ -65,6 +65,12 @@ func (prettyPrinter *PrettyPrinter) resourceTable(opaSessionObj *cautils.OPASess
|
||||
}
|
||||
summaryTable.SetHeader(generateResourceHeader(short))
|
||||
|
||||
var headerColors []tablewriter.Colors
|
||||
for range resourceRows[0] {
|
||||
headerColors = append(headerColors, tablewriter.Colors{tablewriter.Bold, tablewriter.FgHiYellowColor})
|
||||
}
|
||||
summaryTable.SetHeaderColor(headerColors...)
|
||||
|
||||
data := Matrix{}
|
||||
data = append(data, resourceRows...)
|
||||
// For control scan framework will be nil
|
||||
|
||||
Reference in New Issue
Block a user