Auto-sync from catchthesethighs
This commit is contained in:
@@ -237,14 +237,26 @@ draw_bar() {
|
|||||||
local value=$1
|
local value=$1
|
||||||
local max=$2
|
local max=$2
|
||||||
local width=${3:-30}
|
local width=${3:-30}
|
||||||
|
|
||||||
|
# Avoid division by zero
|
||||||
|
[[ $max -eq 0 ]] && max=1
|
||||||
|
|
||||||
local filled=$((value * width / max))
|
local filled=$((value * width / max))
|
||||||
local empty=$((width - filled))
|
local empty=$((width - filled))
|
||||||
|
|
||||||
printf "${GREEN}"
|
# Build filled portion
|
||||||
printf "%${filled}s" | tr ' ' '█'
|
local filled_bar=""
|
||||||
printf "${DIM}"
|
local empty_bar=""
|
||||||
printf "%${empty}s" | tr ' ' '░'
|
local i
|
||||||
printf "${NC}"
|
|
||||||
|
for ((i=0; i<filled; i++)); do
|
||||||
|
filled_bar+="█"
|
||||||
|
done
|
||||||
|
for ((i=0; i<empty; i++)); do
|
||||||
|
empty_bar+="░"
|
||||||
|
done
|
||||||
|
|
||||||
|
printf "%s%s%s%s%s" "${GREEN}" "${filled_bar}" "${DIM}" "${empty_bar}" "${NC}"
|
||||||
}
|
}
|
||||||
|
|
||||||
show_dashboard() {
|
show_dashboard() {
|
||||||
|
|||||||
Reference in New Issue
Block a user