output

package
v1.15.1 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: BSD-3-Clause Imports: 11 Imported by: 0

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

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(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

func NewProgressReader(r io.Reader, progress *Progress) io.Reader

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

func Table(headers []string, rows [][]string)

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

func TintEnabled(value string) string

TintEnabled applies tints for enabled/disabled values.

func TintInsecure

func TintInsecure(value string) string

TintInsecure applies warning tints for insecure values.

func TintStatus

func TintStatus(value string) string

TintStatus applies semantic status coloring to a value.

func TintYesNo

func TintYesNo(value string) string

TintYesNo applies tints for yes/no style values.

func Warning

func Warning(format string, a ...interface{})

Warning prints a warning message in yellow. The message is prefixed with a newline for visual separation. Format specifiers and arguments work like fmt.Printf.

Types

type Progress

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

Progress renders a Bubble Tea progress bar inline.

func StartProgress

func StartProgress(label string, total int64) *Progress

StartProgress starts a progress bar with the given label and total.

func (*Progress) Add

func (p *Progress) Add(delta int64)

Add increments progress by the given value.

func (*Progress) SetCurrent

func (p *Progress) SetCurrent(current int64)

SetCurrent sets the current progress value.

func (*Progress) SetLabel

func (p *Progress) SetLabel(label string)

SetLabel updates the progress label.

func (*Progress) SetTotal

func (p *Progress) SetTotal(total int64)

SetTotal updates the total value.

func (*Progress) Stop

func (p *Progress) Stop()

Stop stops the progress bar and moves to the next line.

type Spinner

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

Spinner renders a Bubble Tea spinner inline.

func StartSpinner

func StartSpinner(label string) *Spinner

StartSpinner starts a spinner with the given label.

func (*Spinner) Stop

func (s *Spinner) Stop()

Stop stops the spinner and moves to the next line.

Jump to

Keyboard shortcuts

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