ui(deploy): reorder progress bar so %, time stay visible on narrow terms

Old layout truncated the critical right-side (1m23s/~3m) on long labels.
New layout puts %, bar, and elapsed/eta on the LEFT, label+subtitle on
the RIGHT where truncation does no harm. Bar shrunk 20→15 chars.
This commit is contained in:
chahinebrini 2026-05-30 10:25:24 +02:00
parent 8f871611f1
commit 4135e388ff

View File

@ -134,10 +134,11 @@ runtime_save() {
}
# Render brew-style SINGLE-LINE progress bar:
# ==> Building xcarchive ████████░░░░░░░░ 42% (1m23s/~3m18s) ↳ CompileSwift Foo
# Layout: ==> 42% ██████░░░ (1m23s/~3m) Label ↳ subtitle
# Critical metrics (%, time) stay LEFT so they're never truncated.
render_progress() {
local elapsed="$1" expected="$2" label="$3" subtitle="$4"
local width=20 pct filled empty bar elapsed_h expected_h line
local width=15 pct filled empty bar elapsed_h expected_h line
if (( expected > 0 )); then
pct=$(( elapsed * 100 / expected ))
(( pct > 99 )) && pct=99
@ -154,11 +155,11 @@ render_progress() {
elapsed_h=$(format_duration "$elapsed")
if (( expected > 0 )); then
expected_h=$(format_duration_rounded "$expected")
line=$(printf '%s==>%s %s %s %s%3d%%%s (%s/~%s)' \
"$BLUE" "$RESET" "$label" "$bar" "$YELLOW" "$pct" "$RESET" "$elapsed_h" "$expected_h")
line=$(printf '%s==>%s %s%3d%%%s %s (%s/~%s) %s' \
"$BLUE" "$RESET" "$YELLOW" "$pct" "$RESET" "$bar" "$elapsed_h" "$expected_h" "$label")
else
line=$(printf '%s==>%s %s %s %s(%s)%s' \
"$BLUE" "$RESET" "$label" "$bar" "$YELLOW" "$elapsed_h" "$RESET")
line=$(printf '%s==>%s %s(%s)%s %s %s' \
"$BLUE" "$RESET" "$YELLOW" "$elapsed_h" "$RESET" "$bar" "$label")
fi
if [[ -n "$subtitle" ]]; then
line="$line$subtitle"