output

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2025 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CaptureOutput

func CaptureOutput(f func()) string

captureOutput captures and returns any output written to stdout during execution of f.

func CaptureOutputErr

func CaptureOutputErr(f func() error) (string, error)

captureOutputErr is a helper function to capture stdout output and return any error

func FormatCommandName

func FormatCommandName(name string, noColor bool) string

FormatCommandName colorizes command names

func FormatConfirmation

func FormatConfirmation(msg string, noColor bool) string

FormatConfirmation returns a formatted confirmation prompt

func FormatExample

func FormatExample(example string, noColor bool) string

FormatExample colorizes command examples in help text

func FormatJSONExample

func FormatJSONExample(json string, noColor bool) string

FormatJSONExample formats JSON examples in help text

func FormatOptionalFlag

func FormatOptionalFlag(flag string, description string, noColor bool) string

FormatOptionalFlag formats optional flags in help text

func FormatPrompt

func FormatPrompt(msg string, noColor bool) string

FormatPrompt returns a formatted input prompt

func FormatRequiredFlag

func FormatRequiredFlag(flag string, description string, noColor bool) string

FormatRequiredFlag highlights required flags in help text

func FormatSuccess

func FormatSuccess(msg string, noColor bool) string

FormatSuccess returns a formatted success string

func FormatUID

func FormatUID(uid string, noColor bool) string

func PrintError

func PrintError(format string, noColor bool, args ...interface{})

PrintError prints an error message with red color

func PrintInfo

func PrintInfo(format string, noColor bool, args ...interface{})

PrintInfo prints an info message with blue color

func PrintOutput

func PrintOutput[T OutputFields](data []T, format string, noColor bool) error

PrintOutput formats data in the specified output style

func PrintResourceCreated

func PrintResourceCreated(resourceType, uid string, noColor bool)

PrintResourceCreated prints a standardized resource creation message

func PrintResourceDeleted

func PrintResourceDeleted(resourceType, uid string, immediate, noColor bool)

PrintResourceDeleted prints a standardized resource deletion message

func PrintResourceSuccess

func PrintResourceSuccess(resourceType, action, uid string, noColor bool)

PrintResourceSuccess prints a success message for a resource operation

func PrintResourceUpdated

func PrintResourceUpdated(resourceType, uid string, noColor bool)

PrintResourceUpdated prints a standardized resource update message

func PrintSuccess

func PrintSuccess(format string, noColor bool, args ...interface{})

PrintSuccess prints a success message with green color and a checkmark

func PrintWarning

func PrintWarning(format string, noColor bool, args ...interface{})

PrintWarning prints a warning message with yellow color

func StripANSIColors

func StripANSIColors(s string) string

stripANSIColors removes ANSI color codes from a string

Types

type Output

type Output interface {
	// contains filtered or unexported methods
}

type OutputFields

type OutputFields interface {
	any
}

OutputFields is a marker interface for output-formattable types

Jump to

Keyboard shortcuts

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