display

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 6, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ColorPercent

func ColorPercent(pct float64) string

func CurrencySymbol

func CurrencySymbol(vs string) string

func FormatLargeNumber

func FormatLargeNumber(n float64, vs ...string) string

func FormatPercent

func FormatPercent(pct float64) string

func FormatPrice

func FormatPrice(price float64, vs ...string) string

func FormatRank

func FormatRank(rank int) string

FormatRank formats a market cap rank, returning "-" for zero/unranked.

func FormatSupply

func FormatSupply(n float64) string

func FormatSymbol

func FormatSymbol(s string) string

FormatSymbol sanitizes and uppercases a coin symbol from API data.

func PrintBanner

func PrintBanner()

PrintBanner prints a compact one-line CoinGecko banner to stderr. Writing to stderr keeps stdout clean for piped data.

func PrintLogo()

PrintLogo prints the full ASCII art CoinGecko logo in brand green to stderr.

func PrintTable

func PrintTable(headers []string, rows [][]string)

func PrintWelcomeBox

func PrintWelcomeBox()

PrintWelcomeBox prints a bordered quick-start box to stderr.

func SanitizeCell

func SanitizeCell(s string) string

SanitizeCell strips all ANSI escape sequences and non-printable control characters from untrusted API data. Call this on API-sourced strings (names, symbols) before passing to PrintTable. Internal color formatting (e.g. ColorPercent) operates on numeric values and should NOT be sanitized.

func VisibleWidth

func VisibleWidth(s string) int

VisibleWidth returns the display width of a string after stripping ANSI escapes.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL