Documentation
¶
Index ¶
- func AddAlias(name, expansion string)
- func AddToken(name string, fn TokenFunc)
- func DeleteAlias(name string)
- func DeleteToken(name string)
- func Flog(w io.Writer, format string, args ...any)
- func Flogln(w io.Writer, format string, args ...any)
- func Fprint(w io.Writer, format string, args ...any)
- func Fprintln(w io.Writer, format string, args ...any)
- func Log(format string, args ...any)
- func Logln(format string, args ...any)
- func Print(format string, args ...any)
- func Println(format string, args ...any)
- func Render(format string, args ...any) string
- func RenderPlain(format string, args ...any) string
- func RenderPlainWithOptions(opts Options, format string, args ...any) string
- func RenderWithOptions(opts Options, format string, args ...any) string
- func Sprint(format string, args ...any) string
- func SprintWithDelims(open, close string, format string, args ...any) string
- func StripANSI(s string) string
- type Options
- type TokenFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddAlias ¶
func AddAlias(name, expansion string)
AddAlias registers or updates an alias. Name is case-insensitive.
func DeleteAlias ¶
func DeleteAlias(name string)
DeleteAlias removes a registered alias. Name is case-insensitive.
func DeleteToken ¶
func DeleteToken(name string)
DeleteToken removes a registered token renderer. Name is case-insensitive.
func Flogln ¶
Flogln writes the rendered output to w with ANSI sequences stripped and ensures a trailing newline.
func Println ¶
Println writes the formatted output to stdout and ensures a trailing newline. If the formatted text already ends with a newline, it is not doubled.
func RenderPlain ¶
RenderPlain formats a string and strips ANSI escape sequences from the result.
func RenderPlainWithOptions ¶
RenderPlainWithOptions formats a string using the provided options and strips ANSI.
func RenderWithOptions ¶
RenderWithOptions formats a string using the provided options.
func Sprint ¶
Sprint returns a formatted string using {} placeholders. Each {} is replaced by the next argument's string representation. If there are more args than placeholders they are appended separated by spaces. If there are fewer args than placeholders the remaining {} are left as-is.
func SprintWithDelims ¶
SprintWithDelims is like Sprint but uses the provided open/close single-character delimiters instead of { and } (e.g. '<' and '>'). If open or close are not single bytes the call falls back to Sprint.
Types ¶
type Options ¶
type Options struct {
// SortMaps sorts supported map keys alphabetically/numerically before rendering.
SortMaps bool
// DisableColour suppresses ANSI output for built-in colour/style tokens.
// NO_COLOR also disables colour automatically.
DisableColour bool
}
Options control rendering behaviour.