Просмотр исходного кода

refactor: improve readability and consistency in code

- Refactored echo statements to provide more informative messages.
- Renamed variables for better clarity.
- Removed unnecessary comments and unused code.
Daniel Gibbs 2 лет назад
Родитель
Сommit
e239aa505b
3 измененных файлов с 8 добавлено и 8 удалено
  1. 6 6
      lgsm/modules/command_update_linuxgsm.sh
  2. 1 1
      lgsm/modules/core_dl.sh
  3. 1 1
      linuxgsm.sh

+ 6 - 6
lgsm/modules/command_update_linuxgsm.sh

@@ -36,7 +36,7 @@ else
 fi
 
 # Check linuxsm.sh
-echo -en "checking ${remotereponame} linuxgsm.sh...\c"
+echo -en "checking ${remotereponame} ( linuxgsm.sh )\c"
 if [ "${remotereponame}" == "GitHub" ]; then
 	curl --connect-timeout 10 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/linuxgsm.sh" 1> /dev/null
 else
@@ -68,13 +68,13 @@ fi
 # Check gameserver.sh
 # Compare gameserver.sh against linuxgsm.sh in the tmp dir.
 # Ignoring server specific vars.
-echo -en "checking ${selfname}...\c"
+echo -en "checking ${selfname}\c"
 fn_script_log_info "Checking ${selfname}"
 script_diff=$(diff <(sed '\/shortname/d;\/gameservername/d;\/gamename/d;\/githubuser/d;\/githubrepo/d;\/githubbranch/d' "${tmpdir}/linuxgsm.sh") <(sed '\/shortname/d;\/gameservername/d;\/gamename/d;\/githubuser/d;\/githubrepo/d;\/githubbranch/d' "${rootdir}/${selfname}"))
 if [ "${script_diff}" != "" ]; then
 	fn_print_update_eol_nl
 	fn_script_log "Checking ${selfname}"
-	echo -en "backup ${selfname}...\c"
+	echo -en "backup ${selfname}\c"
 	fn_script_log_info "Backup ${selfname}"
 	if [ ! -d "${backupdir}/script" ]; then
 		mkdir -p "${backupdir}/script"
@@ -115,7 +115,7 @@ else
 fi
 
 # Check _default.cfg.
-echo -en "checking ${remotereponame} config _default.cfg...\c"
+echo -en "checking ${remotereponame} config ( _default.cfg )\c"
 fn_script_log_info "Checking ${remotereponame} config _default.cfg"
 if [ "${remotereponame}" == "GitHub" ]; then
 	curl --connect-timeout 10 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg" 1> /dev/null
@@ -149,7 +149,7 @@ fi
 
 # Check distro csv. ${datadir}/${distroid}-${distroversioncsv}.csv
 if [ -f "${datadir}/${distroid}-${distroversioncsv}.csv" ]; then
-	echo -en "checking ${remotereponame} config ${distroid}-${distroversioncsv}.csv...\c"
+	echo -en "checking ${remotereponame} config ( ${distroid}-${distroversioncsv}.csv )\c"
 	fn_script_log_info "Checking ${remotereponame} ${distroid}-${distroversioncsv}.csv"
 	if [ "${remotereponame}" == "GitHub" ]; then
 		curl --connect-timeout 10 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/${distroid}-${distroversioncsv}.csv" 1> /dev/null
@@ -187,7 +187,7 @@ if [ -n "${modulesdir}" ]; then
 			for modulefile in *; do
 				# check if module exists in the repo and remove if missing.
 				# commonly used if module names change.
-				echo -en "checking ${remotereponame} module ${modulefile}...\c"
+				echo -en "checking ${remotereponame} module ( ${modulefile} )\c"
 				github_file_url_dir="lgsm/modules"
 				if [ "${remotereponame}" == "GitHub" ]; then
 					curl --connect-timeout 10 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${modulefile}" 1> /dev/null

+ 1 - 1
lgsm/modules/core_dl.sh

@@ -403,7 +403,7 @@ fn_fetch_file() {
 				"${curlcmd[@]}" --progress-bar "${fileurl}" 2>&1
 				exitcode="$?"
 			else
-				echo -en "${dim}fetching from ${fileurl_name} ( ${local_filename} )\c"
+				echo -en "fetching from ${fileurl_name} ( ${local_filename} )\c"
 				"${curlcmd[@]}" --silent --show-error "${fileurl}" 2>&1
 				exitcode="$?"
 			fi

+ 1 - 1
linuxgsm.sh

@@ -106,7 +106,7 @@ fn_bootstrap_fetch_file() {
 			trap fn_fetch_trap INT
 			# Larger files show a progress bar.
 
-			echo -en "fetching from ${fileurl_name} ( ${local_filename} )\c"
+			echo -en "fetching ${fileurl_name} ( ${local_filename} )\c"
 			curlcmd=$(curl --connect-timeout 10 -s --fail -L -o "${local_filedir}/${local_filename}" "${fileurl}" 2>&1)
 
 			local exitcode=$?