Documentation
¶
Overview ¶
Package pretty provides styled terminal output utilities for CLI applications. Boxes, panels, banners, tables, trees, progress bars, and spinners.
Index ¶
- func CreateBanner(title, version, url string, ascii []string) string
- type KeyValuePair
- type MultiProgress
- type Pretty
- func (p *Pretty) Banner(text string)
- func (p *Pretty) Box(title, content string)
- func (p *Pretty) Bullet(level int, text string)
- func (p *Pretty) Debug(message string)
- func (p *Pretty) Error(message string)
- func (p *Pretty) Info(message string)
- func (p *Pretty) KeyValue(key, value string)
- func (p *Pretty) Panel(title, content string)
- func (p *Pretty) Raw(text string)
- func (p *Pretty) Section(title string)
- func (p *Pretty) Success(message string)
- func (p *Pretty) SystemInfo(info *SystemInfo)
- func (p *Pretty) Table(headers []string, rows [][]string)
- func (p *Pretty) Tree(nodes []TreeItem)
- func (p *Pretty) Warn(message string)
- type ProgressBar
- type ProgressItem
- type Spinner
- type SpinnerStyle
- type SystemInfo
- type TreeItem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateBanner ¶
CreateBanner renders a double-border banner box with ASCII art, title, version, and URL.
Types ¶
type KeyValuePair ¶
KeyValuePair is a labelled string value.
type MultiProgress ¶
type MultiProgress struct {
// contains filtered or unexported fields
}
MultiProgress manages multiple progress bars or spinners simultaneously.
func NewMultiProgress ¶
func NewMultiProgress(w io.Writer) *MultiProgress
func (*MultiProgress) Add ¶
func (mp *MultiProgress) Add(item ProgressItem)
func (*MultiProgress) Remove ¶
func (mp *MultiProgress) Remove(item ProgressItem)
func (*MultiProgress) Stop ¶
func (mp *MultiProgress) Stop()
type Pretty ¶
type Pretty struct {
// contains filtered or unexported fields
}
Pretty provides formatted output utilities for styled terminal printing.
func (*Pretty) Box ¶
Box draws a bordered box around content, with an optional title in the top border.
func (*Pretty) SystemInfo ¶
func (p *Pretty) SystemInfo(info *SystemInfo)
SystemInfo prints a titled block of key-value pairs with nil-safe fallback.
type ProgressBar ¶
type ProgressBar struct {
// contains filtered or unexported fields
}
ProgressBar displays progress for long-running operations. Thread-safe for concurrent updates while logging continues.
func NewProgressBar ¶
func NewProgressBar(w io.Writer, total int64, label string) *ProgressBar
func (*ProgressBar) Complete ¶
func (pb *ProgressBar) Complete()
func (*ProgressBar) Increment ¶
func (pb *ProgressBar) Increment(delta int64)
func (*ProgressBar) SetLabel ¶
func (pb *ProgressBar) SetLabel(label string)
func (*ProgressBar) Update ¶
func (pb *ProgressBar) Update(current int64)
type ProgressItem ¶
type ProgressItem interface {
Render() string
}
ProgressItem is implemented by types that can render themselves as a progress line.
type Spinner ¶
type Spinner struct {
// contains filtered or unexported fields
}
Spinner displays an animated spinner for indeterminate progress. Thread-safe and works concurrently with logging.
func (*Spinner) SetStyle ¶
func (s *Spinner) SetStyle(style SpinnerStyle)
func (*Spinner) StopWithError ¶
func (*Spinner) StopWithMessage ¶
func (*Spinner) StopWithSuccess ¶
type SpinnerStyle ¶
type SpinnerStyle int
const ( SpinnerStyleBraille SpinnerStyle = iota SpinnerStyleDots SpinnerStyleArrows SpinnerStyleBounce SpinnerStyleBar )
type SystemInfo ¶
type SystemInfo struct {
Title string
Version string
Fields []KeyValuePair
}
SystemInfo is startup/configuration metadata for display.