Documentation
¶
Overview ¶
Package terminal provides terminal utilities for all binaries Per AI.md PART 7: BINARY REQUIREMENTS - Common Go Modules
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ASCIISymbols = Symbols{ Success: "[OK]", Error: "[ERR]", Warning: "[WARN]", Info: "[INFO]", Pending: "[...]", Spinner: []string{"|", "/", "-", "\\"}, ProgressFG: "#", ProgressBG: "-", BoxTopLeft: "+", BoxTopRight: "+", BoxBottomLeft: "+", BoxBottomRight: "+", BoxHorizontal: "-", BoxVertical: "|", ArrowRight: "->", ArrowLeft: "<-", ArrowUp: "^", ArrowDown: "v", Bullet: "*", Check: "[x]", Cross: "[X]", Ellipsis: "...", }
ASCII symbols (fallback for limited terminals)
var UnicodeSymbols = Symbols{ Success: "✓", Error: "✗", Warning: "⚠", Info: "ℹ", Pending: "◌", Spinner: []string{"⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"}, ProgressFG: "█", ProgressBG: "░", BoxTopLeft: "┌", BoxTopRight: "┐", BoxBottomLeft: "└", BoxBottomRight: "┘", BoxHorizontal: "─", BoxVertical: "│", ArrowRight: "→", ArrowLeft: "←", ArrowUp: "↑", ArrowDown: "↓", Bullet: "•", Check: "✓", Cross: "✗", Ellipsis: "…", }
Unicode symbols (modern terminals)
Functions ¶
Types ¶
type ResizeHandler ¶
type ResizeHandler struct {
// contains filtered or unexported fields
}
ResizeHandler manages terminal resize events
func NewResizeHandler ¶
func NewResizeHandler() *ResizeHandler
NewResizeHandler creates a new resize handler
func (*ResizeHandler) CurrentSize ¶
func (h *ResizeHandler) CurrentSize() Size
CurrentSize returns the current terminal size
func (*ResizeHandler) OnResize ¶
func (h *ResizeHandler) OnResize(callback func(Size))
OnResize registers a callback for resize events
func (*ResizeHandler) Refresh ¶
func (h *ResizeHandler) Refresh()
Refresh manually refreshes the terminal size
func (*ResizeHandler) StartResizeListener ¶
func (h *ResizeHandler) StartResizeListener(ctx context.Context) context.CancelFunc
StartResizeListener starts listening for SIGWINCH signals Returns a cancel function to stop listening
type SizeMode ¶
type SizeMode int
SizeMode represents terminal size breakpoints
const ( // SizeModeMicro - <40 cols or <10 rows SizeModeMicro SizeMode = iota // SizeModeMinimal - 40-59 cols or 10-15 rows SizeModeMinimal // SizeModeCompact - 60-79 cols or 16-23 rows SizeModeCompact // SizeModeStandard - 80-119 cols and 24-39 rows SizeModeStandard // SizeModeWide - 120-199 cols and 40-59 rows SizeModeWide // SizeModeUltrawide - 200-399 cols and 60-79 rows SizeModeUltrawide // SizeModeMassive - 400+ cols and 80+ rows SizeModeMassive )
func (SizeMode) ShowASCIIArt ¶
ShowASCIIArt returns true if terminal is large enough for ASCII art
func (SizeMode) ShowBorders ¶
ShowBorders returns true if terminal supports bordered elements
func (SizeMode) ShowFullInfo ¶
ShowFullInfo returns true if terminal can show full information
func (SizeMode) ShowSidebar ¶
ShowSidebar returns true if terminal is wide enough for sidebar
type Symbols ¶
type Symbols struct {
// Status indicators
Success string
Error string
Warning string
Info string
Pending string
// Progress
Spinner []string
ProgressFG string
ProgressBG string
// Borders
BoxTopLeft string
BoxTopRight string
BoxBottomLeft string
BoxBottomRight string
BoxHorizontal string
BoxVertical string
// Arrows
ArrowRight string
ArrowLeft string
ArrowUp string
ArrowDown string
// Misc
Bullet string
Check string
Cross string
Ellipsis string
}
Symbols provides terminal symbols with Unicode/ASCII fallback
func GetSymbols ¶
func GetSymbols() Symbols
GetSymbols returns the appropriate symbol set based on terminal capabilities