From cead3ebde8f3aee0ef8677158d37f4d04c6629dc Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 8 Sep 2025 09:50:38 +0300 Subject: tmux: colored LLM status with provider + stats; add start heartbeat for LSP/CLI/TUI; theme support via HEXAI_TMUX_STATUS_THEME and HEXAI_TMUX_STATUS_FG/BG; docs: update tmux options and add Helix+tmux quickstart --- internal/textutil/human.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 internal/textutil/human.go (limited to 'internal/textutil/human.go') diff --git a/internal/textutil/human.go b/internal/textutil/human.go new file mode 100644 index 0000000..21907c3 --- /dev/null +++ b/internal/textutil/human.go @@ -0,0 +1,25 @@ +package textutil + +import "fmt" + +// HumanBytes renders n in a short human-friendly form using base-1000 units. +// Examples: 999 -> 999B, 1200 -> 1.2k, 1540000 -> 1.5M +func HumanBytes(n int64) string { + if n < 1000 { + return fmt.Sprintf("%dB", n) + } + const unit = 1000.0 + v := float64(n) + suffix := []string{"k", "M", "G", "T"} + i := 0 + for v >= unit && i < len(suffix)-1 { + v /= unit + i++ + } + s := fmt.Sprintf("%.1f%s", v, suffix[i]) + // Strip trailing ".0" + if len(s) >= 3 && s[len(s)-2:] == ".0" { + s = fmt.Sprintf("%d%s", int(v), suffix[i]) + } + return s +} -- cgit v1.2.3