Documentation
¶
Index ¶
- Variables
- func Confirm(title string) (bool, error)
- func FormatImage(image string, style lipgloss.Style) string
- func FormatRTT(d time.Duration) string
- func IsStderrTerminal() bool
- func IsStdinTerminal() bool
- func IsStdoutTerminal() bool
- func IsTerminalAvailable() bool
- func NewTable() *table.Table
- func PrintWarning(msg string)
- func RunSpinner(ctx context.Context, title string, action func(ctx context.Context) error) error
- func TerminalWidth() int
- func ThemeConfirm() huh.Theme
- func ThemeConfirmDanger() huh.Theme
Constants ¶
This section is empty.
Variables ¶
var ( NoStyle = lipgloss.NewStyle() Faint = lipgloss.NewStyle().Faint(true) Red = lipgloss.NewStyle().Foreground(lipgloss.Red) Green = lipgloss.NewStyle().Foreground(lipgloss.Green) Yellow = lipgloss.NewStyle().Foreground(lipgloss.Yellow) Bold = lipgloss.NewStyle().Bold(true) BoldRed = lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Red) BoldGreen = lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Green) BoldYellow = lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Yellow) NameStyle = lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("152")) URLStyle = lipgloss.NewStyle().Underline(true).Foreground(lipgloss.BrightBlue) )
Functions ¶
func Confirm ¶
Confirm shows a confirmation prompt with a yellow-styled title. If title is empty, it defaults to "Do you want to continue?".
func FormatImage ¶
FormatImage renders an image reference with the given style, using a faint colon separator for tagged images. Returns the styled original string if parsing fails.
func FormatRTT ¶ added in v0.19.0
FormatRTT formats a round-trip time duration as whole milliseconds, e.g. "140ms".
func IsStderrTerminal ¶ added in v0.20.0
func IsStderrTerminal() bool
IsStderrTerminal checks if the standard error is a terminal (TTY).
func IsStdinTerminal ¶
func IsStdinTerminal() bool
IsStdinTerminal checks if the standard input is a terminal (TTY).
func IsStdoutTerminal ¶
func IsStdoutTerminal() bool
IsStdoutTerminal checks if the standard output is a terminal (TTY).
func IsTerminalAvailable ¶ added in v0.20.0
func IsTerminalAvailable() bool
IsTerminalAvailable reports whether the control terminal (TTY) is available so an interactive TUI can run.
func NewTable ¶
NewTable creates a borderless table with bold headers and consistent padding for CLI output.
func PrintWarning ¶
func PrintWarning(msg string)
func RunSpinner ¶ added in v0.20.0
RunSpinner shows an animated spinner that prints title while running action. When the terminal (TTY) is not available, it prints the title as plain text. It renders to stderr so stdout stays clean for command output.
func TerminalWidth ¶
func TerminalWidth() int
TerminalWidth returns the width of the terminal. Returns 0 if stdout is not a terminal or the width cannot be determined.
func ThemeConfirm ¶
ThemeConfirm returns a huh theme with a bold yellow title style for the confirmation prompt.
func ThemeConfirmDanger ¶ added in v0.19.0
ThemeConfirmDanger returns a huh theme with a bold red title style for dangerous confirmation prompts.
Types ¶
This section is empty.