printer

package
v0.197.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var IsTTY = (isatty.IsTerminal(os.Stdout.Fd()) && isatty.IsTerminal(os.Stderr.Fd()) && isatty.IsTerminal(os.Stdin.Fd())) ||
	(isatty.IsCygwinTerminal(os.Stdout.Fd()) && isatty.IsCygwinTerminal(os.Stderr.Fd()) && isatty.IsCygwinTerminal(os.Stdin.Fd()))

Functions

func Bold added in v0.14.0

func Bold(msg interface{}) string

Bold returns a string formatted with bold.

func BoldBlack added in v0.99.0

func BoldBlack(msg interface{}) string

BoldBlack returns a string formatted with Black and bold.

func BoldBlue added in v0.14.0

func BoldBlue(msg interface{}) string

BoldBlue returns a string formatted with blue and bold.

func BoldGreen added in v0.99.0

func BoldGreen(msg interface{}) string

BoldGreen returns a string formatted with green and bold.

func BoldRed added in v0.18.0

func BoldRed(msg interface{}) string

BoldRed returns a string formatted with red and bold.

func BoldYellow added in v0.99.0

func BoldYellow(msg interface{}) string

BoldYellow returns a string formatted with yellow and bold.

func Emoji added in v0.14.0

func Emoji(emoji string) string

func GetMilliseconds added in v0.14.0

func GetMilliseconds(timestamp time.Time) int64

func GetMillisecondsIfExists added in v0.14.0

func GetMillisecondsIfExists(timestamp *time.Time) *int64

func Red added in v0.83.0

func Red(msg interface{}) string

Red returns a string formatted with red and bold.

Types

type Format added in v0.14.0

type Format int

Format defines the option output format of a resource.

const (
	// Human prints it in human readable format. This can be either a table or
	// a single line, depending on the resource implementation.
	Human Format = iota
	JSON
	CSV
)

func NewFormatValue added in v0.14.0

func NewFormatValue(val Format, p *Format) *Format

NewFormatValue is used to define a flag that can be used to define a custom flag via the flagset.Var() method.

func (*Format) Set added in v0.14.0

func (f *Format) Set(s string) error

func (*Format) String added in v0.14.0

func (f *Format) String() string

func (*Format) Type added in v0.14.0

func (f *Format) Type() string

type Printer added in v0.14.0

type Printer struct {
	// contains filtered or unexported fields
}

Printer is used to print information to the defined output.

func NewPrinter added in v0.14.0

func NewPrinter(format *Format) *Printer

NewPrinter returns a new Printer for the given output and format.

func (*Printer) ConfirmCommand added in v0.99.0

func (p *Printer) ConfirmCommand(confirmationName, commandShortName, confirmFailedName string) error

func (*Printer) Format added in v0.14.0

func (p *Printer) Format() Format

Format returns the format that was set for this printer

func (*Printer) PrettyPrintJSON added in v0.96.0

func (p *Printer) PrettyPrintJSON(b []byte) error

func (*Printer) Print added in v0.14.0

func (p *Printer) Print(i ...interface{})

Print is a convenience method to Print to the defined output.

func (*Printer) PrintJSON added in v0.96.0

func (p *Printer) PrintJSON(v interface{}) error

func (*Printer) PrintProgress added in v0.14.0

func (p *Printer) PrintProgress(message string) func()

PrintProgress starts a spinner with the relevant message. The returned function needs to be called in a defer or when it's decided to stop the spinner

func (*Printer) PrintResource added in v0.14.0

func (p *Printer) PrintResource(v interface{}) error

PrintResource prints the given resource in the format it was specified.

func (*Printer) Printf added in v0.14.0

func (p *Printer) Printf(format string, i ...interface{})

Printf is a convenience method to Printf to the defined output.

func (*Printer) Println added in v0.14.0

func (p *Printer) Println(i ...interface{})

Println is a convenience method to Println to the defined output.

func (*Printer) SetHumanOutput added in v0.15.0

func (p *Printer) SetHumanOutput(out io.Writer)

SetHumanOutput sets the output for human readable messages.

func (*Printer) SetResourceOutput added in v0.15.0

func (p *Printer) SetResourceOutput(out io.Writer)

SetResourceOutput sets the output for pringing resources via PrintResource.

Jump to

Keyboard shortcuts

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