Documentation ¶
Index ¶
- Variables
- func TruncateString(str string, length int) string
- type ControlColorSchemaDefinition
- type ControlColorScheme
- type ControlRenderer
- type CounterGraphRenderer
- type CounterRenderer
- type DimensionsRenderer
- type ErrorRenderer
- type GroupHeadingRenderer
- type GroupRenderer
- type GroupTitleRenderer
- type ResultReasonRenderer
- type ResultRenderer
- type ResultStatusRenderer
- type SeverityRenderer
- type SpacerRenderer
- type TableRenderer
Constants ¶
This section is empty.
Variables ¶
var ColorSchemes = map[string]*ControlColorSchemaDefinition{ "dark": { GroupTitle: "bold-bright-white", Severity: "bold-bright-yellow", CountZeroFail: "gray1", CountZeroFailDivider: "gray1", CountDivider: "gray2", CountFail: "bold-bright-red", CountTotal: "bright-white", CountTotalAllPassed: "bold-bright-green", CountGraphFail: "bright-red", CountGraphPass: "bright-green", CountGraphBracket: "gray2", StatusAlarm: "bold-bright-red", StatusError: "bold-bright-red", StatusSkip: "gray3", StatusInfo: "bright-cyan", StatusOK: "bright-green", StatusColon: "gray1", ReasonAlarm: "bright-red", ReasonError: "bright-red", ReasonSkip: "gray3", ReasonInfo: "bright-cyan", ReasonOK: "gray4", Spacer: "gray1", Indent: "gray1", UseColor: true, }, "light": { GroupTitle: "bold-bright-black", Severity: "bold-bright-yellow", CountZeroFail: "gray5", CountZeroFailDivider: "gray5", CountDivider: "gray4", CountFail: "bold-bright-red", CountTotal: "bright-black", CountTotalAllPassed: "bold-bright-green", CountGraphFail: "bright-red", CountGraphPass: "bright-green", CountGraphBracket: "gray4", StatusAlarm: "bold-bright-red", StatusError: "bold-bright-red", StatusSkip: "gray3", StatusInfo: "bright-cyan", StatusOK: "bright-green", StatusColon: "gray5", ReasonAlarm: "bright-red", ReasonError: "bright-red", ReasonSkip: "gray3", ReasonInfo: "bright-cyan", ReasonOK: "gray2", Spacer: "gray5", Indent: "gray5", UseColor: true, }, "plain": {UseColor: false}, }
Functions ¶
func TruncateString ¶
Types ¶
type ControlColorSchemaDefinition ¶
type ControlColorSchemaDefinition struct { // group GroupTitle string Severity string CountZeroFail string CountZeroFailDivider string CountDivider string CountFail string CountTotal string CountTotalAllPassed string CountGraphFail string CountGraphPass string CountGraphBracket string // results StatusAlarm string StatusError string StatusSkip string StatusInfo string StatusOK string StatusColon string ReasonAlarm string ReasonError string ReasonSkip string ReasonInfo string ReasonOK string Spacer string Indent string UseColor bool }
type ControlColorScheme ¶
type ControlColorScheme struct { GroupTitle colorFunc Severity colorFunc CountZeroFail colorFunc CountZeroFailDivider colorFunc CountDivider colorFunc CountFail colorFunc CountTotal colorFunc CountTotalAllPassed colorFunc CountGraphFail colorFunc CountGraphPass colorFunc CountGraphBracket colorFunc StatusAlarm colorFunc StatusError colorFunc StatusSkip colorFunc StatusInfo colorFunc StatusOK colorFunc StatusColon colorFunc ReasonAlarm colorFunc ReasonError colorFunc ReasonSkip colorFunc ReasonInfo colorFunc ReasonOK colorFunc Spacer colorFunc Indent colorFunc ReasonColors map[string]colorFunc StatusColors map[string]colorFunc UseColor bool }
var ControlColors *ControlColorScheme
ControlColors is a global variable containing the current control color scheme
func NewControlColorScheme ¶
func NewControlColorScheme(def *ControlColorSchemaDefinition) (*ControlColorScheme, error)
func (*ControlColorScheme) Initialise ¶
func (c *ControlColorScheme) Initialise(def *ControlColorSchemaDefinition) error
type ControlRenderer ¶
type ControlRenderer struct {
// contains filtered or unexported fields
}
func NewControlRenderer ¶
func NewControlRenderer(run *execute.ControlRun, parent *GroupRenderer) *ControlRenderer
func (ControlRenderer) Render ¶
func (r ControlRenderer) Render() string
type CounterGraphRenderer ¶
type CounterGraphRenderer struct {
// contains filtered or unexported fields
}
func NewCounterGraphRenderer ¶
func NewCounterGraphRenderer(failedControls, totalControls, maxTotalControls int) *CounterGraphRenderer
func (CounterGraphRenderer) Render ¶
func (r CounterGraphRenderer) Render() string
type CounterRenderer ¶
type CounterRenderer struct {
// contains filtered or unexported fields
}
func NewCounterRenderer ¶
func NewCounterRenderer(failedControls, totalControls, maxFailedControls, maxTotalControls int) *CounterRenderer
func (CounterRenderer) Render ¶
func (r CounterRenderer) Render() string
Render returns the counter string in format "<failed> / <total>.
The alignment depends on the maximum failed and maximum total parameters, as the counters are aligned as follows: " 3 / 123" " 13 / 23" "111 / 123" " 1 / 4" " 1 / 1,020"
// NOTE: adds a trailing space
type DimensionsRenderer ¶
type DimensionsRenderer struct {
// contains filtered or unexported fields
}
func NewDimensionsRenderer ¶
func NewDimensionsRenderer(dimensions []execute.Dimension, colorGenerator *execute.DimensionColorGenerator, width int) *DimensionsRenderer
func (DimensionsRenderer) Render ¶
func (r DimensionsRenderer) Render() string
Render returns the reason, truncated to the max length if necessary
type ErrorRenderer ¶
type ErrorRenderer struct {
// contains filtered or unexported fields
}
func NewErrorRenderer ¶
func NewErrorRenderer(err error, width int, indent string) *ErrorRenderer
func (ErrorRenderer) Render ¶
func (r ErrorRenderer) Render() string
type GroupHeadingRenderer ¶
type GroupHeadingRenderer struct {
// contains filtered or unexported fields
}
func NewGroupHeadingRenderer ¶
func NewGroupHeadingRenderer(title string, failed, total, maxFailed, maxTotal, width int, indent string) *GroupHeadingRenderer
func (GroupHeadingRenderer) Render ¶
func (r GroupHeadingRenderer) Render() string
type GroupRenderer ¶
type GroupRenderer struct {
// contains filtered or unexported fields
}
func NewGroupRenderer ¶
func NewGroupRenderer(group *execute.ResultGroup, parent *GroupRenderer, maxFailedControls, maxTotalControls int, resultTree *execute.ExecutionTree, width int) *GroupRenderer
func (GroupRenderer) Render ¶
func (r GroupRenderer) Render() string
type GroupTitleRenderer ¶
type GroupTitleRenderer struct {
// contains filtered or unexported fields
}
func NewGroupTitleRenderer ¶
func NewGroupTitleRenderer(title string, width int) *GroupTitleRenderer
func (GroupTitleRenderer) Render ¶
func (r GroupTitleRenderer) Render() string
Render returns the title, truncated to the max length if necessary NOTE: adds a trailing space
type ResultReasonRenderer ¶
type ResultReasonRenderer struct {
// contains filtered or unexported fields
}
func NewResultReasonRenderer ¶
func NewResultReasonRenderer(status, reason string, width int) *ResultReasonRenderer
func (ResultReasonRenderer) Render ¶
func (r ResultReasonRenderer) Render() string
Render returns the reason, truncated to the max length if necessary NOTE: adds a trailing space
type ResultRenderer ¶
type ResultRenderer struct {
// contains filtered or unexported fields
}
func NewResultRenderer ¶
func NewResultRenderer(status, reason string, dimensions []execute.Dimension, colorGenerator *execute.DimensionColorGenerator, width int, indent string) *ResultRenderer
func (ResultRenderer) Render ¶
func (r ResultRenderer) Render() string
type ResultStatusRenderer ¶
type ResultStatusRenderer struct {
// contains filtered or unexported fields
}
func NewResultStatusRenderer ¶
func NewResultStatusRenderer(status string) *ResultStatusRenderer
func (ResultStatusRenderer) Render ¶
func (r ResultStatusRenderer) Render() string
Render returns the status
type SeverityRenderer ¶
type SeverityRenderer struct {
// contains filtered or unexported fields
}
func NewSeverityRenderer ¶
func NewSeverityRenderer(severity string) *SeverityRenderer
func (SeverityRenderer) Render ¶
func (r SeverityRenderer) Render() string
Render returns ther severity oin upper case, got 'critical' and 'high' severities for all other values an empty string is returned NOTE: adds a trailing space
type SpacerRenderer ¶
type SpacerRenderer struct {
// contains filtered or unexported fields
}
func NewSpacerRenderer ¶
func NewSpacerRenderer(width int) *SpacerRenderer
func (SpacerRenderer) Render ¶
func (r SpacerRenderer) Render() string
Render returns a divider string of format: "....... " NOTE: adds a trailing space
type TableRenderer ¶
type TableRenderer struct {
// contains filtered or unexported fields
}
func NewTableRenderer ¶
func NewTableRenderer(resultTree *execute.ExecutionTree, width int) *TableRenderer
func (TableRenderer) Render ¶
func (r TableRenderer) Render() string