mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-06-28 04:06:54 +00:00
Update utils.sh
This commit is contained in:
parent
a3523ff21a
commit
21c35a49fa
@ -66,6 +66,7 @@ spinner() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Function to simulate typing effect
|
# Function to simulate typing effect
|
||||||
type_text() {
|
type_text() {
|
||||||
local text="$1"
|
local text="$1"
|
||||||
@ -77,6 +78,17 @@ type_text() {
|
|||||||
echo
|
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
|
# Display info message with spinner
|
||||||
msg_info() {
|
msg_info() {
|
||||||
local msg="$1"
|
local msg="$1"
|
||||||
@ -85,12 +97,14 @@ msg_info() {
|
|||||||
SPINNER_PID=$!
|
SPINNER_PID=$!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Display info message
|
# Display info message
|
||||||
msg_info2() {
|
msg_info2() {
|
||||||
local msg="$1"
|
local msg="$1"
|
||||||
echo -ne "${TAB}${YW}${HOLD}${msg}"
|
echo -e "${TAB}${YW}${HOLD}${msg}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Display warning or highlighted information message
|
# Display warning or highlighted information message
|
||||||
msg_warn() {
|
msg_warn() {
|
||||||
if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID > /dev/null; then
|
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}"
|
echo -e "${BFR}${TAB}${YWB}${CL} ${YWB}${msg}${CL}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Display success message
|
# Display success message
|
||||||
msg_ok() {
|
msg_ok() {
|
||||||
if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID > /dev/null; then
|
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}"
|
echo -e "${BFR}${TAB}${CM}${GN}${msg}${CL}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Display error message
|
# Display error message
|
||||||
msg_error() {
|
msg_error() {
|
||||||
if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID > /dev/null; then
|
if [ -n "$SPINNER_PID" ] && ps -p $SPINNER_PID > /dev/null; then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user