diff --git a/README.md b/README.md index 7597925..0609fe3 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # burn-baby-burn +![burn-baby-burn](burn.png) + > *"Burn, baby, burn — disco inferno."* >     — The Trammps, 1976, on the subject of API quotas diff --git a/bin/burn b/bin/burn index 3ff1e60..86d901d 100755 --- a/bin/burn +++ b/bin/burn @@ -288,6 +288,16 @@ round_cents() { awk -v c="$1" 'BEGIN{printf "%.2f", c}' } +# Format a non-negative integer with thousands-grouping commas (21826 -> 21,826). +fmt_num() { + local n=$1 result="" + while ((n >= 1000)); do + result=$(printf ",%03d%s" $((n % 1000)) "$result") + n=$((n / 1000)) + done + printf "%d%s" "$n" "$result" +} + on_interrupt() { if [[ -n "$claude_pid" ]]; then kill "$claude_pid" 2>/dev/null || true @@ -367,7 +377,9 @@ done cost_rounded=$(round_cents "$total_cost") msg="${CELEBRATIONS[RANDOM % ${#CELEBRATIONS[@]}]}" -printf "\n\n%s\n\n" "$msg" -printf " 🔥 torched %s fire tokens across %s call(s) (target: %s)\n" \ - "$burned" "$iteration" "$tokens" -printf " 💰 spent \$%s\n\n" "$cost_rounded" +burned_fmt=$(fmt_num "$burned") +tokens_fmt=$(fmt_num "$tokens") + +printf "\n\n 🔥 torched %s tokens across %s call(s) (target: %s) • 💰 spent \$%s 💵💵💵\n\n" \ + "$burned_fmt" "$iteration" "$tokens_fmt" "$cost_rounded" +printf " %s\n\n" "$msg" diff --git a/burn.png b/burn.png new file mode 100644 index 0000000..892c454 Binary files /dev/null and b/burn.png differ