common

package
v0.37.2 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2024 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// RESET is the escape sequence for unsetting any previous commands.
	RESET = 0
	// ESC is the escape sequence used to send ANSI commands in the terminal.
	ESC = 27
)

Variables

This section is empty.

Functions

func ResultErrorFromStats added in v0.27.0

func ResultErrorFromStats(s stats.Stats) error

ResultErrorFromStats takes a stats object and returns either a ResultError or nil depending on whether the stats reports that resources failed apply/prune/delete or reconciliation.

func SprintfWithColor

func SprintfWithColor(color Color, format string, a ...interface{}) string

SprintfWithColor formats according to the provided pattern and returns the result as a string with the necessary ansii escape codes for color

Types

type Color

type Color int

color is a type that captures the ANSI code for colors on the terminal.

var (
	RED    Color = 31
	GREEN  Color = 32
	YELLOW Color = 33
)

func ColorForStatus

func ColorForStatus(s status.Status) (color Color, setColor bool)

ColorForStatus returns the appropriate Color, which represents the ansii escape code, for different status values.

type ResultError added in v0.27.0

type ResultError struct {
	Stats stats.Stats
}

ResultError is returned from printers when the apply/destroy operations completed, but one or more resources either failed apply/prune/delete, or failed to reconcile.

func (*ResultError) Error added in v0.27.0

func (a *ResultError) Error() string

Jump to

Keyboard shortcuts

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