Documentation
¶
Index ¶
- Constants
- Variables
- func ColumnWidths(margin, minFlex int, percentages ...int) []int
- func Debug(format string, args ...interface{})
- func FormatDuration(d time.Duration) string
- func Info(format string, args ...interface{})
- func Infof(format string, args ...interface{})
- func IsStdinTerminal() bool
- func IsTerminal() bool
- func PlainStatusIcon(status, state string) string
- func PlainStatusText(status, state string) string
- func PrintJSON(data interface{}) error
- func PrintLogo()
- func PrintPlainTable(headers []string, rows [][]string, noHeader bool)
- func PrintTable(headers []string, rows [][]string)
- func RelativeTime(t time.Time) string
- func StatusIcon(status, state string) string
- func StatusText(status, state string) string
- func Success(format string, args ...interface{})
- func TerminalSize() (int, int)
- func TerminalWidth() int
- func Truncate(s string, maxLen int) string
- func Warn(format string, args ...interface{})
- func WithPager(fn func(w io.Writer))
Constants ¶
const Logo = `` /* 229-byte string literal not displayed */
Variables ¶
var ( Green = color.New(color.FgGreen).SprintFunc() Red = color.New(color.FgRed).SprintFunc() Yellow = color.New(color.FgYellow).SprintFunc() Cyan = color.New(color.FgCyan).SprintFunc() Bold = color.New(color.Bold).SprintFunc() Faint = color.New(color.Faint).SprintFunc() )
var Quiet bool
Quiet suppresses non-essential output when true
var Verbose bool
Verbose enables debug output when true
Functions ¶
func ColumnWidths ¶
ColumnWidths calculates column widths for a table based on terminal width. margin is the space reserved for non-flexible content (padding, fixed columns). minFlex is the minimum flexible space to use. percentages defines how to divide the flexible space among columns. Returns the calculated widths for each column.
func Debug ¶
func Debug(format string, args ...interface{})
Debug prints debug info when verbose mode is enabled
func FormatDuration ¶
FormatDuration formats a duration in human-readable form
func Info ¶
func Info(format string, args ...interface{})
Info prints an informational message (respects --quiet)
func Infof ¶
func Infof(format string, args ...interface{})
Infof prints formatted info without newline (respects --quiet)
func IsStdinTerminal ¶
func IsStdinTerminal() bool
IsStdinTerminal returns true if stdin is a terminal
func PlainStatusIcon ¶
PlainStatusIcon returns a plain text status icon (for --plain output)
func PlainStatusText ¶
PlainStatusText returns plain status text (for --plain output)
func PrintPlainTable ¶
PrintPlainTable prints tab-separated output for scripting (works with cut -f, awk)
func PrintTable ¶
PrintTable prints a formatted table with proper Unicode/ANSI handling
func RelativeTime ¶
RelativeTime formats a time as relative to now
func StatusIcon ¶
StatusIcon returns a colored status icon
func StatusText ¶
StatusText returns colored status text
func Success ¶
func Success(format string, args ...interface{})
Success prints a success message with green checkmark (respects --quiet)
func TerminalSize ¶
TerminalSize returns terminal width and height (defaults: 80x24)
func TerminalWidth ¶
func TerminalWidth() int
TerminalWidth returns the terminal width, or 80 as default
func Truncate ¶
Truncate truncates a string to maxLen display width, adding "..." if truncated Properly handles unicode and wide characters
Types ¶
This section is empty.