Documentation
¶
Overview ¶
Package output provides formatted terminal output utilities for the CLI.
This package offers consistent styling for success messages, errors, warnings, informational text, headers, key-value pairs, and tables. All output includes appropriate color coding for better readability in terminal environments.
Example Usage ¶
output.Success("Operation completed")
output.Error("Something went wrong: %v", err)
output.KeyValue("Status", "Running")
output.Table([]string{"ID", "Name"}, rows)
Index ¶
- func Error(format string, a ...interface{})
- func Header(format string, a ...interface{})
- func Info(format string, a ...interface{})
- func KeyValue(key string, value interface{})
- func NewProgressReader(r io.Reader, progress *Progress) io.Reader
- func Print(format string, a ...interface{})
- func Success(format string, a ...interface{})
- func Table(headers []string, rows [][]string)
- func TintEnabled(value string) string
- func TintInsecure(value string) string
- func TintStatus(value string) string
- func TintYesNo(value string) string
- func Warning(format string, a ...interface{})
- type Progress
- type Spinner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Error ¶
func Error(format string, a ...interface{})
Error prints an error message in red. The message is prefixed with a newline for visual separation. Format specifiers and arguments work like fmt.Printf.
func Header ¶
func Header(format string, a ...interface{})
Header prints a header message in bold white. Use this to introduce sections of output. The message is prefixed with a newline for visual separation.
func Info ¶
func Info(format string, a ...interface{})
Info prints an info message in cyan. The message is prefixed with a newline for visual separation. Format specifiers and arguments work like fmt.Printf.
func KeyValue ¶
func KeyValue(key string, value interface{})
KeyValue prints a key-value pair with the key in bold and value in blue. This is useful for displaying structured information like image details or configuration values.
func NewProgressReader ¶
NewProgressReader wraps a reader to report progress updates.
func Print ¶
func Print(format string, a ...interface{})
Print prints a standard message without color formatting. Use this for regular output that doesn't need status indication.
func Success ¶
func Success(format string, a ...interface{})
Success prints a success message in green. The message is prefixed with a newline for visual separation. Format specifiers and arguments work like fmt.Printf.
func Table ¶
Table prints a formatted table with headers and rows. Headers are displayed in bold cyan. The table is rendered with borders for a clean terminal appearance. Columns are automatically aligned.
func TintEnabled ¶
TintEnabled applies tints for enabled/disabled values.
func TintInsecure ¶
TintInsecure applies warning tints for insecure values.
func TintStatus ¶
TintStatus applies semantic status coloring to a value.
Types ¶
type Progress ¶
type Progress struct {
// contains filtered or unexported fields
}
Progress renders a Bubble Tea progress bar inline.
func StartProgress ¶
StartProgress starts a progress bar with the given label and total.
func (*Progress) SetCurrent ¶
SetCurrent sets the current progress value.
type Spinner ¶
type Spinner struct {
// contains filtered or unexported fields
}
Spinner renders a Bubble Tea spinner inline.
func StartSpinner ¶
StartSpinner starts a spinner with the given label.