spinner() {
local pid="$1" msg="$2"
local chars="⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏"
local i=0
while kill -0 "$pid" 2>/dev/null; do
printf "\r%s %s " "${chars:i++%${#chars}:1}" "$msg"
sleep 0.1
done
printf "\r✓ %s\n" "$msg"
}
with_spinner() {
local msg="$1"; shift
"$@" &
spinner $! "$msg"
wait $!
}
with_spinner "Downloading…" sleep 3
with_spinner "Installing…" sleep 2
with_spinner "Running tests" pytest -q
Create a free account and build your private vault. Share publicly whenever you want.