Documentation
¶
Overview ¶
Package table contains utilities for rendering tables
Index ¶
Constants ¶
const (
// Simple is a simple table
Simple = "simple"
)
Variables ¶
This section is empty.
Functions ¶
func BestDetail ¶ added in v0.1.0
func BestDetail(eval EvalStatus) layouts.ColoredColumn
BestDetail returns the best detail for the given evaluation status.
func GetStatusIcon ¶ added in v0.1.0
func GetStatusIcon(eval EvalStatus, emoji bool) layouts.ColoredColumn
GetStatusIcon returns a colored column with the status icon for the given evaluation status.
Types ¶
type EvalStatus ¶ added in v0.1.0
type EvalStatus interface {
GetStatus() string
GetStatusDetail() string
GetRemediationStatus() string
GetRemediationDetail() string
GetAlert() StatusDetails
}
EvalStatus provides an abstract interface for reading evaluation status. Since we don't have common shapes between e.g. EvaluationHistory and RuleEvaluationStatus, we use an interface modeled on RuleEvaluationStatus to adapt the two. (We would use the EvaluationHistory shape, but the sub-message return values are structs that don't match the interface here.)
type StatusDetails ¶ added in v0.1.0
StatusDetails provides an abstract interface for reading status details. This is currently only used for Alert status, because those structures consistently expose this pattern.
type Table ¶
type Table interface {
AddRow(row ...string)
AddRowWithColor(row ...layouts.ColoredColumn)
// Render outputs the table to stdout (TODO: make output configurable)
Render()
// SeparateRows ensures each row is clearly separated (probably because it is multi-line)
SeparateRows()
}
Table is an interface for rendering tables