Cosmetic: ANSI line wipe; hide (0 packages) on idempotent re-runs
Two nits from YuKu's laptop paste: the 100-space line wipe left a visible gap before short summaries (now ANSI EL: \r\033[K, no residue), and '(0 packages)' printed when nothing new was installed (idempotent re-run / theme deps all present) — the count parenthetical is now omitted when zero.
This commit is contained in:
+14
-6
@@ -173,18 +173,26 @@ ui_quiet_run() {
|
||||
|
||||
local rc=0
|
||||
wait "$pid" || rc=$?
|
||||
printf '\r%*s\r' 100 '' >&2
|
||||
# ANSI erase-line: wipes the live line without leaving trailing spaces
|
||||
# (a 100-space wipe left a visible gap when the summary was shorter)
|
||||
printf '\r\033[K' >&2
|
||||
|
||||
if (( rc == 0 )); then
|
||||
n=$(sed -n "$((before+1)),\$p" "$log" 2>/dev/null | grep -ac '^Installing' || true)
|
||||
local plural="s"
|
||||
(( n == 1 )) && plural=""
|
||||
local count_txt=""
|
||||
if (( n > 0 )); then
|
||||
local plural="s"
|
||||
(( n == 1 )) && plural=""
|
||||
count_txt=" (${n} package${plural})"
|
||||
fi
|
||||
# n == 0 means nothing new was installed (idempotent re-run /
|
||||
# deps already present): print the message without a count.
|
||||
if (( depth == 256 )); then
|
||||
printf '\033[48;5;34m \033[0m %s (%s package%s)\n' "$msg" "$n" "$plural" >&2
|
||||
printf '\033[48;5;34m \033[0m %s%s\n' "$msg" "$count_txt" >&2
|
||||
elif (( depth == 16 )); then
|
||||
printf '\033[42m \033[0m %s (%s package%s)\n' "$msg" "$n" "$plural" >&2
|
||||
printf '\033[42m \033[0m %s%s\n' "$msg" "$count_txt" >&2
|
||||
else
|
||||
ok "$msg (${n} package${plural})"
|
||||
ok "$msg${count_txt}"
|
||||
fi
|
||||
return 0
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user