From 8f871611f10f6837ee194c8ec00cdedb6f48a5bb Mon Sep 17 00:00:00 2001 From: chahinebrini Date: Sat, 30 May 2026 10:21:51 +0200 Subject: [PATCH] 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). --- apps/rebreak-native/deploy.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/apps/rebreak-native/deploy.sh b/apps/rebreak-native/deploy.sh index 8bb3825..74edbe1 100755 --- a/apps/rebreak-native/deploy.sh +++ b/apps/rebreak-native/deploy.sh @@ -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" # 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: