format

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SuccessChar = "✓"
	FailureChar = "✗"
)

Variables

This section is empty.

Functions

func Confirmf

func Confirmf(format string, a ...any) (bool, error)

Confirmf prints a confirm dialog using format and then waits until prompt is confirmed or denied. Only y and yes are accepted for confirmation.

func FailureMessagef

func FailureMessagef(icon, format string, a ...any) string

FailureMessagef is a formatted message for indicating a failed step.

func NewSpinner

func NewSpinner(message, stopMessage string) (*yacspin.Spinner, error)

NewSpinner returns a new spinner with the default config

func PrettyPrintObjects

func PrettyPrintObjects[T resource.Managed](objs []T, opts PrintOpts) error

PrettyPrintObjects prints the supplied objects in "pretty" colored yaml with some metadata, status and other default fields stripped out. If multiple objects are supplied, they will be divided with a yaml divider.

func PrintFailuref

func PrintFailuref(icon, format string, a ...any)

PrintFailuref prints a failure message.

func PrintSuccessf

func PrintSuccessf(icon, format string, a ...any)

PrintSuccessf prints a success message.

func ProgressMessagef

func ProgressMessagef(icon, format string, a ...any) string

ProgressMessagef is a formatted message for use with a spinner.Suffix. An icon can be added which is displayed at the end of the message.

func SuccessMessagef

func SuccessMessagef(icon, format string, a ...any) string

SuccessMessagef is a formatted message for indicating a successful step.

Types

type PrintOpts

type PrintOpts struct {
	// Out will be used to print to if set instead of stdout.
	Out io.Writer
	// ExcludeAdditional allows to exclude more fields of the object
	ExcludeAdditional [][]string
}

PrintOpts customizes the printing.

Jump to

Keyboard shortcuts

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