charmbracelet external gum optional tui π«§ Gum β Terminal UI Enhancement charmbracelet/gum is an optional dependency that provides beautifully styled terminal output (borders, spinners, styled text, selection menus) when installed. All output gracefully falls back to standard Zsh print -P with ANSI codes when gum is not available.
π¦ Installation # mise (recommended)
mise use -g gum
# Arch / Manjaro
sudo pacman -S gum
# Homebrew (macOS / Linux)
brew install gum
# apt (Debian / Ubuntu)
sudo apt install gum
Verify: command -v gum && gum --version
ποΈ Architecture The ZSHAND framework has two separate gum integration layers:
Layer File Language Scope Runtime IO shared_functions/00_gum_io.zsh Zsh All framework output (core, hooks, startup, functions, widgets, build) Installers installers/general/gum_helpers.sh Bash Installer scripts only (POSIX-ish, standalone)
The runtime layer is the primary integration point. It provides:
Cached gum detection β _ZSHAND_HAS_GUM integer flag, set once at source time Zero-cost checks β (( _ZSHAND_HAS_GUM )) is a single integer comparison Terminal detection β Gum is bypassed when stdout/stderr is not a TTY Safe mode bypass β ZSHAND_SAFE_MODE=1 forces all output to plain text π¨ Function Reference Core Log Functions These replace the original 01_stderr_error.zsh, 02_stderr_warn.zsh, 04_echo_info.zsh, and 05_echo_ok.zsh (which are now backward-compat stubs).
Function Channel Gum Mode Fallback stderr_error "msg" stderr gum log --level error print -P "%F{red}σ±Έ ERROR:%f msg" stderr_warn "msg" stderr gum log --level warn print -P "%F{yellow}σ±Έ Warning:%f msg" echo_info "msg" stdout gum log --level info print -P "%F{blue}π msg%f" echo_ok "msg" stdout gum log --prefix β print -P "%F{green}β msg%f"
Rich Output Functions Function Purpose Gum Mode Fallback az_banner "text" Double-border title banner gum style --border double ASCII ββ box az_header "text" Bold section header gum style --bold ββ text ββ az_note "text" [color] Callout box gum style --border rounded ASCII βββ box az_divider Horizontal line gum style --foreground 240 ββββββββ az_step N M "label" Step counter [N/M] gum style --bold Plain [N/M] label az_done "text" Green completion banner gum style --border rounded β text az_progress "icon" "color" "msg" Progress indicator gum style --foreground print -P "%F{color}..." az_styled_box "color" ["content"] Colored border box (pipe or string) gum style --border rounded ASCII βββ box
Interactive Functions Function Purpose Gum Mode Fallback az_spin "title" cmd... Spinner with β/β result gum spin --title echo -n "title ... "; cmd az_confirm "prompt" [opts] Y/N confirmation gum confirm echo -n "prompt (Y/n) "; read az_choose "A" "B" "C" Single selection menu gum choose Numbered list + read echo ... \| az_filter_multi Multi-select with search gum filter --no-limit cat (passthrough) az_input "prompt" "default" Text input gum input echo -n "prompt [default]: "; read
Timer Functions Function Purpose az_timer_start Record start time az_elapsed Print "completed in Nm Ns"
βοΈ Environment Variables Variable Type Default Description _ZSHAND_HAS_GUM int auto 1 if gum found, 0 otherwise. Set at source time. ZSHAND_SAFE_MODE bool 0 Forces gum off when 1 GUM_SPIN_SPINNER string dot Gum spinner style GUM_SPIN_SPINNER_FOREGROUND string 212 Spinner color GUM_CONFIRM_PROMPT_FOREGROUND string 212 Confirm prompt color
π§ͺ Testing # Run the gum IO spec
just test spec/shared_functions/gum_io_spec.sh
# Run all shared function specs
just test spec/shared_functions/
Tests force fallback mode by setting _ZSHAND_HAS_GUM=0 after sourcing, ensuring all fallback code paths are exercised regardless of whether gum is installed on the test machine.
February 8, 2026 February 8, 2026