mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-06-27 20:06:52 +00:00
Update utils.sh
This commit is contained in:
parent
a3523ff21a
commit
21c35a49fa
@ -66,6 +66,7 @@ spinner() {
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
# Function to simulate typing effect
|
||||
type_text() {
|
||||
local text="$1"
|
||||
@ -77,6 +78,17 @@ type_text() {
|
||||
echo
|
||||
}
|
||||
|
||||
|
||||
# Stop the spinner if it is active
|
||||
cleanup() {
|
||||
if [ -n "$spinner_pid" ]; then
|
||||
kill $spinner_pid 2>/dev/null
|
||||
fi
|
||||
echo -e "\n$(translate "Operation canceled by the user.")"
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
# Display info message with spinner
|
||||
msg_info() {
|
||||
local msg="$1"
|
||||
@ -85,12 +97,14 @@ msg_info() {
|
||||
SPINNER_PID=$!
|
||||
}
|
||||
|
||||
|
||||
# Display info message
|
||||
msg_info2() {
|
||||
local msg="$1"
|
||||
echo -ne "${TAB}${YW}${HOLD}${msg}"
|
||||
echo -e "${TAB}${YW}${HOLD}${msg}"
|
||||
}
|
||||
|
||||
|
||||
# Display warning or highlighted information message
|
||||
msg_warn() {
|
||||
if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID > /dev/null; then
|
||||
@ -101,6 +115,7 @@ msg_warn() {
|
||||
echo -e "${BFR}${TAB}${YWB}${CL} ${YWB}${msg}${CL}"
|
||||
}
|
||||
|
||||
|
||||
# Display success message
|
||||
msg_ok() {
|
||||
if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID > /dev/null; then
|
||||
@ -111,6 +126,7 @@ msg_ok() {
|
||||
echo -e "${BFR}${TAB}${CM}${GN}${msg}${CL}"
|
||||
}
|
||||
|
||||
|
||||
# Display error message
|
||||
msg_error() {
|
||||
if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID > /dev/null; then
|
||||
|
Loading…
x
Reference in New Issue
Block a user