Update core.func
This commit is contained in:
parent
34814cd8be
commit
ae6a6bff81
@ -327,6 +327,10 @@ fatal() {
|
|||||||
kill -INT $$
|
kill -INT $$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# Spinner- und Messaging-Framework (TTY-sicher, CI-kompatibel)
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
spinner() {
|
spinner() {
|
||||||
local chars=(⠋ ⠙ ⠹ ⠸ ⠼ ⠴ ⠦ ⠧ ⠇ ⠏)
|
local chars=(⠋ ⠙ ⠹ ⠸ ⠼ ⠴ ⠦ ⠧ ⠇ ⠏)
|
||||||
local i=0
|
local i=0
|
||||||
@ -337,11 +341,6 @@ spinner() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
clear_line() {
|
|
||||||
tput cr 2>/dev/null || echo -en "\r"
|
|
||||||
tput el 2>/dev/null || echo -en "\033[K"
|
|
||||||
}
|
|
||||||
|
|
||||||
stop_spinner() {
|
stop_spinner() {
|
||||||
local pid="${SPINNER_PID:-}"
|
local pid="${SPINNER_PID:-}"
|
||||||
[[ -z "$pid" && -f /tmp/.spinner.pid ]] && pid=$(</tmp/.spinner.pid)
|
[[ -z "$pid" && -f /tmp/.spinner.pid ]] && pid=$(</tmp/.spinner.pid)
|
||||||
@ -372,17 +371,24 @@ msg_info() {
|
|||||||
stop_spinner
|
stop_spinner
|
||||||
SPINNER_MSG="$msg"
|
SPINNER_MSG="$msg"
|
||||||
|
|
||||||
|
# Sonderfall: Alpine oder verbose → kein Spinner
|
||||||
if is_verbose_mode || is_alpine; then
|
if is_verbose_mode || is_alpine; then
|
||||||
local HOURGLASS="${TAB}⏳${TAB}"
|
local HOURGLASS="${TAB}⏳${TAB}"
|
||||||
printf "\r\e[2K%s %b" "$HOURGLASS" "${YW}${msg}${CL}" >&2
|
printf "\r\e[2K%s %b\n" "$HOURGLASS" "${YW}${msg}${CL}" >&2
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
color_spinner
|
# Spinner nur starten, wenn ein echtes TTY und keine SIGTTOU-Gefahr
|
||||||
spinner &
|
if [[ -t 1 && ! "$(ps -o stat= -p $$)" =~ T && -z "$NO_SPINNER" ]]; then
|
||||||
SPINNER_PID=$!
|
color_spinner
|
||||||
echo "$SPINNER_PID" >/tmp/.spinner.pid
|
spinner &
|
||||||
disown "$SPINNER_PID" 2>/dev/null || true
|
SPINNER_PID=$!
|
||||||
|
echo "$SPINNER_PID" >/tmp/.spinner.pid
|
||||||
|
disown "$SPINNER_PID" 2>/dev/null || true
|
||||||
|
else
|
||||||
|
# Fallback: reiner Text
|
||||||
|
printf "\r\e[2K⏳ %b\n" "${YW}${msg}${CL}" >&2
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
msg_ok() {
|
msg_ok() {
|
||||||
@ -415,6 +421,11 @@ msg_custom() {
|
|||||||
echo -e "${BFR:-} ${symbol} ${color}${msg}${CL:-\e[0m}"
|
echo -e "${BFR:-} ${symbol} ${color}${msg}${CL:-\e[0m}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clear_line() {
|
||||||
|
tput cr 2>/dev/null || echo -en "\r"
|
||||||
|
tput el 2>/dev/null || echo -en "\033[K"
|
||||||
|
}
|
||||||
|
|
||||||
# msg_ok() {
|
# msg_ok() {
|
||||||
# local msg="$1"
|
# local msg="$1"
|
||||||
# [[ -z "$msg" ]] && return
|
# [[ -z "$msg" ]] && return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user