printer

package
v1.9.19 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2023 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StdErr = color.Error
View Source
var StdOut = color.Output

Functions

func GetFileNameText added in v1.5.13

func GetFileNameText(title string) string

Types

type EvaluationSummary

type EvaluationSummary struct {
	ConfigsCount              int
	RulesCount                int
	FilesCount                int
	PassedYamlValidationCount int
	K8sValidation             string
	PassedPolicyCheckCount    int
}

type ExtraMessage

type ExtraMessage struct {
	Text  string
	Color string
}

type FailedRule

type FailedRule struct {
	Name               string
	Occurrences        int
	Suggestion         string
	DocumentationUrl   string
	PACIdentifier      string
	OccurrencesDetails []OccurrenceDetails
}

type InvalidK8sInfo

type InvalidK8sInfo struct {
	ValidationErrors  []error
	ValidationWarning string
	K8sVersion        string
}

type InvalidYamlInfo

type InvalidYamlInfo struct {
	ValidationErrors []error
}

type JSONSchemaValidatorResults

type JSONSchemaValidatorResults = gojsonschema.Result

type OccurrenceDetails

type OccurrenceDetails struct {
	MetadataName              string
	Kind                      string
	SkipMessage               string
	FailureLocations          []cliClient.FailureLocation
	ValidationFailureMessages []string
}

type Printer

type Printer struct {
	Theme *Theme
}

func CreateNewPrinter

func CreateNewPrinter() *Printer

func (*Printer) GetEvaluationSummaryText added in v1.5.0

func (p *Printer) GetEvaluationSummaryText(summary EvaluationSummary, k8sVersion string) string

func (*Printer) GetSummaryTableText added in v1.5.0

func (p *Printer) GetSummaryTableText(summary Summary) string

func (*Printer) GetTextInColor added in v1.5.0

func (p *Printer) GetTextInColor(text string, color *color.Color) string

func (*Printer) GetTitleText added in v1.5.13

func (p *Printer) GetTitleText(title string) string

func (*Printer) GetWarningsText added in v1.5.0

func (p *Printer) GetWarningsText(warnings []Warning, quiet bool) string

func (*Printer) GetYamlValidationErrorsText added in v1.5.0

func (p *Printer) GetYamlValidationErrorsText(yamlValidationErrors []error) string

func (*Printer) GetYamlValidationSummaryText added in v1.5.0

func (p *Printer) GetYamlValidationSummaryText(passedFiles int, allFiles int) string

func (*Printer) PrintError added in v1.8.45

func (p *Printer) PrintError(messageText string, messageColor string)

func (*Printer) PrintMessage

func (p *Printer) PrintMessage(messageText string, messageColor string)

func (*Printer) PrintPromptMessage

func (p *Printer) PrintPromptMessage(promptMessage string)

func (*Printer) PrintYamlSchemaResults

func (p *Printer) PrintYamlSchemaResults(errorsResult []jsonschema.Detailed, error error)

func (*Printer) SetTheme

func (p *Printer) SetTheme(theme *Theme)

type Summary

type Summary struct {
	PlainRows  []SummaryItem
	SkipRow    SummaryItem
	ErrorRow   SummaryItem
	SuccessRow SummaryItem
}

type SummaryItem

type SummaryItem struct {
	RightCol string
	LeftCol  string
	RowIndex int
}

type Theme

type Theme struct {
	Name   string
	Colors struct {
		Green     *color.Color
		Yellow    *color.Color
		RedBold   *color.Color
		Error     *color.Color
		Highlight *color.Color
		Cyan      *color.Color
		CyanBold  *color.Color
	}
	ColorsAttributes struct {
		Cyan  color.Attribute
		Green color.Attribute
		Red   color.Attribute
	}
	Spacing struct {
		Default string
	}
	Emoji struct {
		Error      string
		Suggestion string
		Skip       string
	}
}

func CreateSimpleTheme

func CreateSimpleTheme() *Theme

type Warning

type Warning struct {
	Title           string
	FailedRules     []FailedRule
	SkippedRules    []FailedRule
	InvalidYamlInfo InvalidYamlInfo
	InvalidK8sInfo  InvalidK8sInfo
	ExtraMessages   []ExtraMessage
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL