From a73057808a09bb406296fb6146b80500d4ec233c Mon Sep 17 00:00:00 2001 From: "Aaron D. Lee" Date: Tue, 16 Dec 2025 09:10:58 -0500 Subject: [PATCH] Auto-sync from catchthesethighs --- bin/dotfiles-stats.sh | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/bin/dotfiles-stats.sh b/bin/dotfiles-stats.sh index b63ef4f..1f0bd91 100755 --- a/bin/dotfiles-stats.sh +++ b/bin/dotfiles-stats.sh @@ -237,14 +237,26 @@ draw_bar() { local value=$1 local max=$2 local width=${3:-30} + + # Avoid division by zero + [[ $max -eq 0 ]] && max=1 + local filled=$((value * width / max)) local empty=$((width - filled)) - printf "${GREEN}" - printf "%${filled}s" | tr ' ' '█' - printf "${DIM}" - printf "%${empty}s" | tr ' ' '░' - printf "${NC}" + # Build filled portion + local filled_bar="" + local empty_bar="" + local i + + for ((i=0; i