From 9ac48c4c6225f6744692895c4b0697da9cbcbd97 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Mon, 2 Oct 2023 00:18:04 +0100 Subject: [PATCH] refactor: simplify fn_print_ok and fn_print_ok_nl functions The code changes in this commit refactor the `fn_print_ok` and `fn_print_ok_nl` functions in the `core_messages.sh` file. The changes remove unnecessary formatting and only print the command action and self name if they exist. This simplifies the code and improves readability. chore: improve error message in fix.sh In the `fix.sh` file, an error message has been improved to provide clearer information when a registered fix script does not exist. The message now states that the specific fix script is registered but doesn't exist, without mentioning any typos or modifications to other files. These changes enhance the functionality and maintainability of the codebase. --- lgsm/modules/core_messages.sh | 8 ++++---- lgsm/modules/fix.sh | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lgsm/modules/core_messages.sh b/lgsm/modules/core_messages.sh index e0faae0c2d..e6f6f13d0f 100644 --- a/lgsm/modules/core_messages.sh +++ b/lgsm/modules/core_messages.sh @@ -143,18 +143,18 @@ fn_print_dots_nl() { # [ OK ] fn_print_ok() { if [ "${commandaction}" ]; then - echo -en "${bold}${creeol}[${green} OK ${default}]${default} ${commandaction} ${selfname}: $*" + echo -en "${commandaction} ${selfname}: $*" else - echo -en "${bold}${creeol}[${green} OK ${default}]${default} $*" + echo -en "$*" fi fn_sleep_time } fn_print_ok_nl() { if [ "${commandaction}" ]; then - echo -en "${bold}${creeol}[${green} OK ${default}]${default} ${commandaction} ${selfname}: $*" + echo -en "${commandaction} ${selfname}: $*" else - echo -en "${bold}${creeol}[${green} OK ${default}]${default} $*" + echo -en "$*" fi fn_sleep_time echo -en "\n" diff --git a/lgsm/modules/fix.sh b/lgsm/modules/fix.sh index 6b1be83316..6dbce438e8 100644 --- a/lgsm/modules/fix.sh +++ b/lgsm/modules/fix.sh @@ -58,7 +58,7 @@ apply_post_install_fix=(av kf kf2 lo ro samp ut2k4 ut ut3) # validate registered fixes for safe development for fix in "${apply_pre_start_fix[@]}" "${apply_post_install_fix[@]}"; do if ! fn_exists_fix "${fix}"; then - fn_print_fail_nl "fix_${fix}.sh is registered but doesn't exist. Typo or did you miss to modify core_functions.sh?" + fn_print_fail_nl "fix_${fix}.sh is registered but doesn't exist." exitcode=1 core_exit.sh fi