Documentation
¶
Index ¶
- Constants
- Variables
- func Banner(title string)
- func BlueText(s string) string
- func BoldText(s string) string
- func ConfirmYN(prompt string) bool
- func CyanText(s string) string
- func DimText(s string) string
- func FormatDuration(seconds int) string
- func FormatSize(bytes int64) string
- func GreenText(s string) string
- func Hint(msg string)
- func Interactive() bool
- func LogDebug(msg string)
- func LogError(msg string)
- func LogInfo(msg string)
- func LogSuccess(msg string)
- func LogWarn(msg string)
- func PrintKeyValue(key, value string)
- func RedText(s string) string
- func SectionHeader(title string)
- func Separator()
- func SetColorsEnabled(enabled bool)
- func ShortenHome(path, home string) string
- func Truncate(s string, max int) string
- func YellowText(s string) string
Constants ¶
const ( Red = "\033[0;31m" Green = "\033[0;32m" Yellow = "\033[1;33m" Blue = "\033[0;34m" Cyan = "\033[0;36m" Bold = "\033[1m" Dim = "\033[2m" Reset = "\033[0m" )
ANSI color codes
Variables ¶
var DebugEnabled bool
Functions ¶
func ConfirmYN ¶ added in v0.12.0
ConfirmYN writes prompt and returns true only for an explicit y/yes typed on an interactive terminal. Non-interactive stdin, EOF, a read error and every other answer are a declined confirmation.
func FormatDuration ¶
FormatDuration formats seconds into a human-readable duration.
func FormatSize ¶
FormatSize formats bytes into human-readable size.
func Interactive ¶ added in v0.12.0
func Interactive() bool
Interactive reports whether there is a human on the other end of stdin who can answer a prompt. Callers guarding a destructive action must check this before asking: a non-interactive run has to decline, not read the pipe.
func LogSuccess ¶
func LogSuccess(msg string)
func PrintKeyValue ¶
func PrintKeyValue(key, value string)
PrintKeyValue prints a key-value pair with dim key.
func SectionHeader ¶
func SectionHeader(title string)
SectionHeader prints a bold section header with a separator line.
func SetColorsEnabled ¶
func SetColorsEnabled(enabled bool)
SetColorsEnabled controls whether ANSI codes are emitted.
func ShortenHome ¶
ShortenHome replaces the home directory prefix with ~.
func YellowText ¶
Types ¶
This section is empty.