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: