printer

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ColorStatus

func ColorStatus(status string, theme *config.Theme) (config.Color, bool)

Types

type ApplyPrinter

type ApplyPrinter struct {
	Theme *config.Theme
}

func (*ApplyPrinter) Print

func (ap *ApplyPrinter) Print(r io.Reader, w io.Writer)

kubectl apply deployment.apps/foo unchanged deployment.apps/bar created deployment.apps/quux configured

type DescribePrinter

type DescribePrinter struct {
	TablePrinter *TablePrinter
	// contains filtered or unexported fields
}

DescribePrinter is a specific printer to print kubectl describe format.

func (*DescribePrinter) Print

func (dp *DescribePrinter) Print(r io.Reader, w io.Writer)

type ExplainPrinter

type ExplainPrinter struct {
	DarkBackground bool
	Theme          *config.Theme
	Recursive      bool
}

ExplainPrinter is a specific printer to print kubectl explain format.

func (*ExplainPrinter) Print

func (ep *ExplainPrinter) Print(r io.Reader, w io.Writer)

type JsonPrinter

type JsonPrinter struct {
	Theme *config.Theme
}

func (*JsonPrinter) Print

func (jp *JsonPrinter) Print(r io.Reader, w io.Writer)

type KubectlOutputColoredPrinter

type KubectlOutputColoredPrinter struct {
	SubcommandInfo    *kubectl.SubcommandInfo
	Recursive         bool
	ObjFreshThreshold time.Duration
	Theme             *config.Theme
}

KubectlOutputColoredPrinter is a printer to print data depending on which kubectl subcommand is executed.

func (*KubectlOutputColoredPrinter) Print

func (kp *KubectlOutputColoredPrinter) Print(r io.Reader, w io.Writer)

Print reads r then write it to w, its format is based on kubectl subcommand. If given subcommand is not supported by the printer, it prints data in Green.

type OptionsPrinter

type OptionsPrinter struct {
	Theme *config.Theme
}

func (*OptionsPrinter) Print

func (op *OptionsPrinter) Print(r io.Reader, w io.Writer)

type Printer

type Printer interface {
	Print(r io.Reader, w io.Writer)
}

Printer can print something. It reads data from r, then write them in w.

type SingleColoredPrinter

type SingleColoredPrinter struct {
	Color config.Color
}

SingleColoredPrinter is a printer to print something in pre-configured color.

func (*SingleColoredPrinter) Print

func (sp *SingleColoredPrinter) Print(r io.Reader, w io.Writer)

Print reads r then writes it in w in sp.Color

type TablePrinter

type TablePrinter struct {
	WithHeader     bool
	DarkBackground bool
	Theme          *config.Theme
	ColorDeciderFn func(index int, column string) (config.Color, bool)
	// contains filtered or unexported fields
}

func NewTablePrinter

func NewTablePrinter(withHeader bool, theme *config.Theme, colorDeciderFn func(index int, column string) (config.Color, bool)) *TablePrinter

func (*TablePrinter) Print

func (tp *TablePrinter) Print(r io.Reader, w io.Writer)

type VersionClientPrinter added in v0.3.0

type VersionClientPrinter struct {
	Theme *config.Theme
}

func (*VersionClientPrinter) Print added in v0.3.0

func (vsp *VersionClientPrinter) Print(r io.Reader, w io.Writer)

kubectl version --client=true Client Version: v1.29.0 Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3

type VersionPrinter

type VersionPrinter struct {
	Theme *config.Theme
}

func (*VersionPrinter) Print

func (vp *VersionPrinter) Print(r io.Reader, w io.Writer)

kubectl version --client=false Client Version: v1.29.0 Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3 Server Version: v1.27.5-gke.200

type WithFuncPrinter

type WithFuncPrinter struct {
	Fn func(line string) config.Color
}

WithFuncPrinter is a printer to print something based on injected logic.

func (*WithFuncPrinter) Print

func (wp *WithFuncPrinter) Print(r io.Reader, w io.Writer)

Print reads r then writes it in w but its color is decided by pre-injected function. The function must not be nil, otherwise it panics.

type YamlPrinter

type YamlPrinter struct {
	Theme *config.Theme
	// contains filtered or unexported fields
}

func (*YamlPrinter) Print

func (yp *YamlPrinter) Print(r io.Reader, w io.Writer)

Jump to

Keyboard shortcuts

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