feat(deploy): round ETA display (~8m statt ~8m00s)
Baseline aus tmp/.deploy-runtimes wird weiterhin per Run aktualisiert (genauer Sekunden-Wert im Cache, nur Display gerundet).
This commit is contained in:
parent
adc506291a
commit
8f871611f1
@ -153,7 +153,7 @@ render_progress() {
|
||||
bar=$(printf '%*s' "$filled" '' | tr ' ' '█')$(printf '%*s' "$empty" '' | tr ' ' '░')
|
||||
elapsed_h=$(format_duration "$elapsed")
|
||||
if (( expected > 0 )); then
|
||||
expected_h=$(format_duration "$expected")
|
||||
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")
|
||||
else
|
||||
@ -177,6 +177,20 @@ format_duration() {
|
||||
fi
|
||||
}
|
||||
|
||||
# Rounded format for ETA display: nearest minute when >= 90s, half-minute when 60-89s
|
||||
format_duration_rounded() {
|
||||
local s="$1"
|
||||
if (( s < 60 )); then
|
||||
printf '%ds' "$s"
|
||||
elif (( s < 90 )); then
|
||||
printf '1m'
|
||||
else
|
||||
# Round to nearest minute (>=30s rounds up)
|
||||
local m=$(( (s + 30) / 60 ))
|
||||
printf '%dm' "$m"
|
||||
fi
|
||||
}
|
||||
|
||||
# run_quiet "Label" <log-file> <cmd...>
|
||||
# Runs cmd silently with a brew-style progress bar (time-based, learns durations
|
||||
# across runs). On error dumps last 40 log lines and exits. With --verbose / non-TTY:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user