From 59e7309418b7f1e578970c3c4ac4b2732d166dff Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Sun, 1 Oct 2023 22:38:18 +0100 Subject: [PATCH] refactor: improve consistency and readability of code - Changed the color of "Missing Server Details" to bold yellow - Changed the color of "Query IP Addresses" to bold yellow - Changed the color of "Game Server Ports" to bold yellow - Changed the color of "SS Output" to bold yellow - Changed the color of "Query Port - Raw Output" to bold yellow - Changed the color of "Gamedig Raw Output" to bold yellow - Changed the color of "gsquery Raw Output" to bold yellow - Changed the color of "TCP Raw Output" to bold yellow - Changed the color of "Game Port - Raw Output" to bold yellow - Changed the color of "Steam Master Server Response" to bold yellow - Updated commit message formatting for better readability --- lgsm/modules/command_dev_details.sh | 2 +- lgsm/modules/command_dev_query_raw.sh | 20 +++++++++---------- lgsm/modules/command_install_resources_mta.sh | 2 +- lgsm/modules/command_sponsor.sh | 2 +- lgsm/modules/core_getopt.sh | 2 +- lgsm/modules/fix.sh | 2 +- lgsm/modules/info_messages.sh | 9 --------- 7 files changed, 15 insertions(+), 24 deletions(-) diff --git a/lgsm/modules/command_dev_details.sh b/lgsm/modules/command_dev_details.sh index 2659465d33..c1ed205d31 100644 --- a/lgsm/modules/command_dev_details.sh +++ b/lgsm/modules/command_dev_details.sh @@ -90,7 +90,7 @@ done # Output the missing server details if there are any. if [ -n "$missing_details" ]; then echo -e "" - echo -e "${lightgreen}Missing Server Details${default}" + echo -e "${bold}${lightyellow}Missing Server Details${default}" fn_messages_separator echo -e "${missing_details}" fi diff --git a/lgsm/modules/command_dev_query_raw.sh b/lgsm/modules/command_dev_query_raw.sh index cf9e148586..a2363f5e10 100644 --- a/lgsm/modules/command_dev_query_raw.sh +++ b/lgsm/modules/command_dev_query_raw.sh @@ -16,14 +16,14 @@ info_distro.sh info_messages.sh echo -e "" -echo -e "${lightgreen}Query IP Addresses${default}" +echo -e "${bold}${lightyellow}Query IP Addresses${default}" fn_messages_separator echo -e "" for queryip in "${queryips[@]}"; do echo -e "${queryip}" done echo -e "" -echo -e "${lightgreen}Game Server Ports${default}" +echo -e "${bold}${lightyellow}Game Server Ports${default}" fn_messages_separator { echo -e "${lightblue}Port Name \tPort Number \tStatus \tTCP \tUDP${default}" @@ -183,18 +183,18 @@ fn_messages_separator } \ | column -s $'\t' -t echo -e "" -echo -e "${lightgreen}SS Output${default}" +echo -e "${bold}${lightyellow}SS Output${default}" fn_messages_separator fn_info_message_ports eval "${portcommand}" echo -e "" -echo -e "${lightgreen}Query Port - Raw Output${default}" +echo -e "${bold}${lightyellow}Query Port - Raw Output${default}" fn_messages_separator echo -e "" echo -e "PORT: ${port}" echo -e "QUERY PORT: ${queryport}" echo -e "" -echo -e "${lightgreen}Gamedig Raw Output${default}" +echo -e "${bold}${lightyellow}Gamedig Raw Output${default}" fn_messages_separator echo -e "" if [ ! "$(command -v gamedig 2> /dev/null)" ]; then @@ -210,7 +210,7 @@ for queryip in "${queryips[@]}"; do echo "${gamedigraw}" | jq done echo -e "" -echo -e "${lightgreen}gsquery Raw Output${default}" +echo -e "${bold}${lightyellow}gsquery Raw Output${default}" fn_messages_separator echo -e "" for queryip in "${queryips[@]}"; do @@ -222,7 +222,7 @@ for queryip in "${queryips[@]}"; do "${modulesdir}"/query_gsquery.py -a "${queryip}" -p "${queryport}" -e "${querytype}" done echo -e "" -echo -e "${lightgreen}TCP Raw Output${default}" +echo -e "${bold}${lightyellow}TCP Raw Output${default}" fn_messages_separator echo -e "" for queryip in "${queryips[@]}"; do @@ -238,10 +238,10 @@ for queryip in "${queryips[@]}"; do fi done echo -e "" -echo -e "${lightgreen}Game Port - Raw Output${default}" +echo -e "${bold}${lightyellow}Game Port - Raw Output${default}" fn_messages_separator echo -e "" -echo -e "${lightgreen}TCP Raw Output${default}" +echo -e "${bold}${lightyellow}TCP Raw Output${default}" fn_messages_separator echo -e "" for queryip in "${queryips[@]}"; do @@ -257,7 +257,7 @@ for queryip in "${queryips[@]}"; do fi done echo -e "" -echo -e "${lightgreen}Steam Master Server Response${default}" +echo -e "${bold}${lightyellow}Steam Master Server Response${default}" fn_messages_separator echo -e "" echo -e "curl -m 3 -s https://api.steampowered.com/ISteamApps/GetServersAtAddress/v0001?addr=${publicip}" diff --git a/lgsm/modules/command_install_resources_mta.sh b/lgsm/modules/command_install_resources_mta.sh index 31a9165fd4..20774daf5e 100644 --- a/lgsm/modules/command_install_resources_mta.sh +++ b/lgsm/modules/command_install_resources_mta.sh @@ -12,7 +12,7 @@ fn_firstcommand_set fn_install_resources() { echo -e "" - echo -e "${lightyellow}Installing Default Resources${default}" + echo -e "${bold}${lightyellow}Installing Default Resources${default}" fn_messages_separator fn_fetch_file "http://mirror.mtasa.com/mtasa/resources/mtasa-resources-latest.zip" "" "" "" "${tmpdir}" "mtasa-resources-latest.zip" "nochmodx" "norun" "noforce" "nohash" fn_dl_extract "${tmpdir}" "mtasa-resources-latest.zip" "${resourcesdir}" diff --git a/lgsm/modules/command_sponsor.sh b/lgsm/modules/command_sponsor.sh index ea49a30993..3d859faccc 100755 --- a/lgsm/modules/command_sponsor.sh +++ b/lgsm/modules/command_sponsor.sh @@ -11,7 +11,7 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_firstcommand_set fn_print_ascii_logo -echo -e "${lightyellow}Support LinuxGSM${default}" +echo -e "${bold}${lightyellow}Support LinuxGSM${default}" fn_messages_separator echo -e "" echo -e "Been using LinuxGSM?" diff --git a/lgsm/modules/core_getopt.sh b/lgsm/modules/core_getopt.sh index 1003839eaf..876293ef6a 100644 --- a/lgsm/modules/core_getopt.sh +++ b/lgsm/modules/core_getopt.sh @@ -169,7 +169,7 @@ fn_opt_usage() { echo -e "LinuxGSM - ${gamename} - Version ${version}" echo -e "https://linuxgsm.com/${gameservername}" echo -e "" - echo -e "${lightyellow}Commands${default}" + echo -e "${bold}${lightyellow}Commands${default}" # Display available commands. index="0" { diff --git a/lgsm/modules/fix.sh b/lgsm/modules/fix.sh index 9a4f5b779b..6b1be83316 100644 --- a/lgsm/modules/fix.sh +++ b/lgsm/modules/fix.sh @@ -79,7 +79,7 @@ fi if [ "${commandname}" == "INSTALL" ]; then if grep -qEe "(^|\s)${shortname}(\s|$)" <<< "${apply_post_install_fix[@]}"; then echo -e "" - echo -e "${lightyellow}Applying Post-Install Fixes${default}" + echo -e "${bold}${lightyellow}Applying Post-Install Fixes${default}" fn_messages_separator postinstall=1 fn_apply_fix "post install" "${shortname}" diff --git a/lgsm/modules/info_messages.sh b/lgsm/modules/info_messages.sh index 2d706d7ba1..d205c08a8f 100644 --- a/lgsm/modules/info_messages.sh +++ b/lgsm/modules/info_messages.sh @@ -7,15 +7,6 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" -# Separator is different for details. -fn_messages_separator() { - if [ "${commandname}" == "DETAILS" ]; then - printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' = - else - echo -e "${bold}=================================${default}" - fi -} - # Removes the passwords form all but details. fn_info_message_password_strip() { if [ "${commandname}" != "DETAILS" ]; then