Documentation
¶
Index ¶
- func CaptureOutput(f func()) string
- func CaptureOutputErr(f func() error) (string, error)
- func FormatCommandName(name string, noColor bool) string
- func FormatConfirmation(msg string, noColor bool) string
- func FormatExample(example string, noColor bool) string
- func FormatJSONExample(json string, noColor bool) string
- func FormatNewValue(value string, noColor bool) string
- func FormatOldValue(value string, noColor bool) string
- func FormatOptionalFlag(flag string, description string, noColor bool) string
- func FormatPrompt(msg string, noColor bool) string
- func FormatRequiredFlag(flag string, description string, noColor bool) string
- func FormatSuccess(msg string, noColor bool) string
- func FormatUID(uid string, noColor bool) string
- func PrintError(format string, noColor bool, args ...interface{})
- func PrintInfo(format string, noColor bool, args ...interface{})
- func PrintOutput[T OutputFields](data []T, format string, noColor bool) error
- func PrintResourceCreated(resourceType, uid string, noColor bool)
- func PrintResourceDeleted(resourceType, uid string, immediate, noColor bool)
- func PrintResourceSuccess(resourceType, action, uid string, noColor bool)
- func PrintResourceUpdated(resourceType, uid string, noColor bool)
- func PrintSuccess(format string, noColor bool, args ...interface{})
- func PrintWarning(format string, noColor bool, args ...interface{})
- func StripANSIColors(s string) string
- type Output
- type OutputFields
- type Spinner
- func NewSpinner(noColor bool) *Spinner
- func PrintResourceCreating(resourceType, uid string, noColor bool) *Spinner
- func PrintResourceDeleting(resourceType, uid string, noColor bool) *Spinner
- func PrintResourceGetting(resourceType, uid string, noColor bool) *Spinner
- func PrintResourceListing(resourceType string, noColor bool) *Spinner
- func PrintResourceUpdating(resourceType, uid string, noColor bool) *Spinner
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 ¶
captureOutputErr is a helper function to capture stdout output and return any error
func FormatCommandName ¶
FormatCommandName colorizes command names
func FormatConfirmation ¶
FormatConfirmation returns a formatted confirmation prompt
func FormatExample ¶
FormatExample colorizes command examples in help text
func FormatJSONExample ¶
FormatJSONExample formats JSON examples in help text
func FormatNewValue ¶ added in v0.3.4
func FormatOldValue ¶ added in v0.3.4
Helper functions to format old and new values
func FormatOptionalFlag ¶
FormatOptionalFlag formats optional flags in help text
func FormatPrompt ¶
FormatPrompt returns a formatted input prompt
func FormatRequiredFlag ¶
FormatRequiredFlag highlights required flags in help text
func FormatSuccess ¶
FormatSuccess returns a formatted success string
func PrintError ¶
PrintError prints an error message with red color
func PrintOutput ¶
func PrintOutput[T OutputFields](data []T, format string, noColor bool) error
PrintOutput formats data in the specified output style
func PrintResourceCreated ¶
PrintResourceCreated prints a standardized resource creation message
func PrintResourceDeleted ¶
PrintResourceDeleted prints a standardized resource deletion message
func PrintResourceSuccess ¶
PrintResourceSuccess prints a success message for a resource operation
func PrintResourceUpdated ¶
PrintResourceUpdated prints a standardized resource update message
func PrintSuccess ¶
PrintSuccess prints a success message with green color and a checkmark
func PrintWarning ¶
PrintWarning prints a warning message with yellow color
func StripANSIColors ¶
stripANSIColors removes ANSI color codes from a string
Types ¶
type OutputFields ¶
type OutputFields interface {
any
}
OutputFields is a marker interface for output-formattable types
type Spinner ¶ added in v0.4.0
type Spinner struct {
// contains filtered or unexported fields
}
Spinner represents a loading spinner with state
func NewSpinner ¶ added in v0.4.0
NewSpinner creates a new spinner instance
func PrintResourceCreating ¶ added in v0.4.0
PrintResourceCreating shows an animated spinner while a resource is being created
func PrintResourceDeleting ¶ added in v0.4.0
PrintResourceDeleting shows an animated spinner while a resource is being deleted
func PrintResourceGetting ¶ added in v0.4.0
PrintResourceGetting shows an animated spinner while getting a resource's details
func PrintResourceListing ¶ added in v0.4.0
PrintResourceListing shows an animated spinner while resources are being listed
func PrintResourceUpdating ¶ added in v0.4.0
PrintResourceUpdating shows an animated spinner while a resource is being updated
func (*Spinner) Stop ¶ added in v0.4.0
func (s *Spinner) Stop()
Stop halts the spinner animation and clears the line
func (*Spinner) StopWithSuccess ¶ added in v0.4.0
StopWithSuccess stops the spinner and shows a success message