mirror of
https://github.com/the-sane/lug-helper.git
synced 2025-01-29 05:49:02 +00:00
Sanity check message function arguments
This commit is contained in:
parent
e3f3a64fe5
commit
632ce7f506
@ -50,8 +50,15 @@ conf_subdir="starcitizen-lug"
|
||||
# To call this function, use the following format: message [type] "[string]"
|
||||
# See the message types below for instructions on formatting the string.
|
||||
message() {
|
||||
# Sanity check
|
||||
if [ "$#" -lt 2 ]; then
|
||||
echo -e "\nScript error: The message function expects two arguments. Aborting."
|
||||
read -n 1 -s -p "Press any key..."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Use zenity messages if available
|
||||
if [ "$has_zen" -eq 1 ]; then
|
||||
# Use zenity messages if available
|
||||
case "$1" in
|
||||
"info")
|
||||
# info message
|
||||
@ -69,7 +76,7 @@ message() {
|
||||
margs=("--question" "--text=")
|
||||
;;
|
||||
*)
|
||||
echo -e "\nInvalid message type passed to the message function. Aborting."
|
||||
echo -e "\nScript Error: Invalid message type passed to the message function. Aborting."
|
||||
read -n 1 -s -p "Press any key..."
|
||||
exit 0
|
||||
;;
|
||||
@ -116,7 +123,7 @@ message() {
|
||||
done
|
||||
;;
|
||||
*)
|
||||
echo -e "\nInvalid message type passed to the message function. Aborting."
|
||||
echo -e "\nScript Error: Invalid message type passed to the message function. Aborting."
|
||||
read -n 1 -s -p "Press any key..."
|
||||
exit 0
|
||||
;;
|
||||
|
Loading…
x
Reference in New Issue
Block a user