Skip to content

Commit

Permalink
refactor: simplify fn_print_ok and fn_print_ok_nl functions
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dgibbs64 committed Oct 1, 2023
1 parent cd07132 commit 9ac48c4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions lgsm/modules/core_messages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion lgsm/modules/fix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9ac48c4

Please sign in to comment.