β³ Progress & Prompts
Progress bars, spinners, loaders, animations, and interactive prompts.
π Progress
Adds a newline by default. Use --inline for loop-based updates.
shui progress 50 100
shui progress 50 100 --width=30 --label="Downloading "
for i in {1..100}; do
shui progress $i 100 --inline
sleep 0.05
done
echoββββββββββββββββββββββββββββββββββββββββ 50%
Downloading ββββββββββββββββββββββββββββββ 50%Pass --iterm (or --iterm=<state>) to also update the native macOS progress
indicator in iTerm2 β normal, success, warning, error,
indeterminate, or clear. No-op in other terminals.
π Spinner
Runs a command in the background with a spinner. Exits with the command's exit code, and in iTerm2 emits an indeterminate badge while running.
shui spinner "Installingβ¦" -- brew install ripgrep
shui spinner \
--success="Installed!" \
--fail="Installation failed" \
"Installingβ¦" -- npm installβ Loader
Indeterminate loading indicator β loops for a fixed duration then clears the
line. Use when you can't wrap a command in spinner.
shui loader "Installing packages"
shui loader --duration=10 "Building"
shui loader --style=pulse "Connecting"| Style | Description |
|---|---|
dots | Cycling dot trail β . .. ... |
pulse | Bold/dim alternating text |
spinner | Braille spinner character |
π¬ Animation
One-shot text effects β play once and exit.
shui typewriter "Deploying to productionβ¦"
shui typewriter --delay=0.05 --color=success "Done!"
shui fade-in "Welcome"
shui fade-in --steps=10 "Welcome"π¬ Interactive
Prompt the user for confirmation, a selection, or free-form input.
# Confirm β exits 0 for yes, 1 for no
shui confirm "Deploy to production?"
# Select β numbered list, prints the chosen option to stdout
choice=$(shui select "Pick a profile:" work personal staging)
# Radio β ββ to move, Enter to confirm
env=$(shui radio "Target environment:" development staging production)
# Multiselect β Space to toggle, Enter to confirm
choices=$(shui multiselect "Which packages?" brew npm cargo)
# Input β prints the entered value to stdout
name=$(shui input --default="world" "Your name:")