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:
parent
8f871611f1
commit
4135e388ff
@ -134,10 +134,11 @@ runtime_save() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Render brew-style SINGLE-LINE progress bar:
|
# 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() {
|
render_progress() {
|
||||||
local elapsed="$1" expected="$2" label="$3" subtitle="$4"
|
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
|
if (( expected > 0 )); then
|
||||||
pct=$(( elapsed * 100 / expected ))
|
pct=$(( elapsed * 100 / expected ))
|
||||||
(( pct > 99 )) && pct=99
|
(( pct > 99 )) && pct=99
|
||||||
@ -154,11 +155,11 @@ render_progress() {
|
|||||||
elapsed_h=$(format_duration "$elapsed")
|
elapsed_h=$(format_duration "$elapsed")
|
||||||
if (( expected > 0 )); then
|
if (( expected > 0 )); then
|
||||||
expected_h=$(format_duration_rounded "$expected")
|
expected_h=$(format_duration_rounded "$expected")
|
||||||
line=$(printf '%s==>%s %s %s %s%3d%%%s (%s/~%s)' \
|
line=$(printf '%s==>%s %s%3d%%%s %s (%s/~%s) %s' \
|
||||||
"$BLUE" "$RESET" "$label" "$bar" "$YELLOW" "$pct" "$RESET" "$elapsed_h" "$expected_h")
|
"$BLUE" "$RESET" "$YELLOW" "$pct" "$RESET" "$bar" "$elapsed_h" "$expected_h" "$label")
|
||||||
else
|
else
|
||||||
line=$(printf '%s==>%s %s %s %s(%s)%s' \
|
line=$(printf '%s==>%s %s(%s)%s %s %s' \
|
||||||
"$BLUE" "$RESET" "$label" "$bar" "$YELLOW" "$elapsed_h" "$RESET")
|
"$BLUE" "$RESET" "$YELLOW" "$elapsed_h" "$RESET" "$bar" "$label")
|
||||||
fi
|
fi
|
||||||
if [[ -n "$subtitle" ]]; then
|
if [[ -n "$subtitle" ]]; then
|
||||||
line="$line ↳ $subtitle"
|
line="$line ↳ $subtitle"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user