common

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PlainFormat is for plain terminal output, possibly colored.
	PlainFormat = "plain"
	// MarkdownFormat is for markdown output suitable for `*.md` files.
	MarkdownFormat = "markdown"
	// JSONFormat is for JSON output with kube-linter's own data structs.
	JSONFormat = "json"
	// SARIFFormat is JSON-based standard for reporting lint errors.
	// See https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=sarif
	SARIFFormat = "sarif"
)

Variables

This section is empty.

Functions

func FormatJSON

func FormatJSON(out io.Writer, data interface{}) error

FormatJSON formats data as JSON, i.e. implements JSONFormat.

func MustInstantiateMarkdownTemplate

func MustInstantiateMarkdownTemplate(templateStr string, customFuncMap template.FuncMap) *template.Template

MustInstantiateMarkdownTemplate instantiates the given go template with a common list of markdown functions. It panics if there is an error.

func MustInstantiatePlainTemplate

func MustInstantiatePlainTemplate(templateStr string, customFuncMap template.FuncMap) *template.Template

MustInstantiatePlainTemplate instantiates the given go template with a common list of functions for console output. It panics if there is an error.

Types

type FormatFunc

type FormatFunc func(io.Writer, interface{}) error

FormatFunc sets contract formatter of each FormatType should follow.

type FormatType

type FormatType string

FormatType defines possible output formats.

type Formatters

type Formatters struct {
	Formatters map[FormatType]FormatFunc
}

Formatters struct provides way to define supported output formats for a command.

func (Formatters) FormatterByType

func (f Formatters) FormatterByType(t string) (FormatFunc, error)

FormatterByType looks up formatter for a given type among the ones configured in this instance.

func (Formatters) GetEnabledFormatters

func (f Formatters) GetEnabledFormatters() []string

GetEnabledFormatters returns a string slice enumerating all enabled formatters of this instance.

Jump to

Keyboard shortcuts

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