Daniel Gibbs 1 年之前
父節點
當前提交
8feb4b2fb5
共有 1 個文件被更改,包括 11 次插入11 次删除
  1. 11 11
      lgsm/modules/core_getopt.sh

+ 11 - 11
lgsm/modules/core_getopt.sh

@@ -158,27 +158,27 @@ currentopt+=("${cmd_sponsor[@]}")
 optcommands=()
 optcommands=()
 index="0"
 index="0"
 for ((index = "0"; index < ${#currentopt[@]}; index += 3)); do
 for ((index = "0"; index < ${#currentopt[@]}; index += 3)); do
-	cmdamount=$(echo -e "${currentopt[index]}" | awk -F ';' '{ print NF }')
+	cmdamount=$(fn_print_nl "${currentopt[index]}" | awk -F ';' '{ print NF }')
 	for ((cmdindex = 1; cmdindex <= cmdamount; cmdindex++)); do
 	for ((cmdindex = 1; cmdindex <= cmdamount; cmdindex++)); do
-		optcommands+=("$(echo -e "${currentopt[index]}" | awk -F ';' -v x=${cmdindex} '{ print $x }')")
+		optcommands+=("$(fn_print_nl "${currentopt[index]}" | awk -F ';' -v x=${cmdindex} '{ print $x }')")
 	done
 	done
 done
 done
 
 
 # Shows LinuxGSM usage.
 # Shows LinuxGSM usage.
 fn_opt_usage() {
 fn_opt_usage() {
-	echo -e "Usage: $0 [option]"
-	echo -e ""
-	echo -e "LinuxGSM - ${gamename} - Version ${version}"
-	echo -e "https://linuxgsm.com/${gameservername}"
-	echo -e ""
-	echo -e "${bold}${lightyellow}Commands${default}"
+	fn_print_nl "Usage: $0 [option]"
+	fn_print_nl ""
+	fn_print_nl "LinuxGSM - ${gamename} - Version ${version}"
+	fn_print_nl "https://linuxgsm.com/${gameservername}"
+	fn_print_nl ""
+	fn_print_nl "${bold}${lightyellow}Commands${default}"
 	# Display available commands.
 	# Display available commands.
 	index="0"
 	index="0"
 	{
 	{
 		for ((index = "0"; index < ${#currentopt[@]}; index += 3)); do
 		for ((index = "0"; index < ${#currentopt[@]}; index += 3)); do
 			# Hide developer commands.
 			# Hide developer commands.
 			if [ "${currentopt[index + 2]}" != "DEVCOMMAND" ]; then
 			if [ "${currentopt[index + 2]}" != "DEVCOMMAND" ]; then
-				echo -e "${cyan}$(echo -e "${currentopt[index]}" | awk -F ';' '{ print $2 }')\t${default}$(echo -e "${currentopt[index]}" | awk -F ';' '{ print $1 }')\t| ${currentopt[index + 2]}"
+				fn_print_nl "${cyan}$(fn_print_nl "${currentopt[index]}" | awk -F ';' '{ print $2 }')\t${default}$(fn_print_nl "${currentopt[index]}" | awk -F ';' '{ print $1 }')\t| ${currentopt[index + 2]}"
 			fi
 			fi
 		done
 		done
 	} | column -s $'\t' -t
 	} | column -s $'\t' -t
@@ -196,9 +196,9 @@ for i in "${optcommands[@]}"; do
 		# Seek and run command.
 		# Seek and run command.
 		index="0"
 		index="0"
 		for ((index = "0"; index < ${#currentopt[@]}; index += 3)); do
 		for ((index = "0"; index < ${#currentopt[@]}; index += 3)); do
-			currcmdamount=$(echo -e "${currentopt[index]}" | awk -F ';' '{ print NF }')
+			currcmdamount=$(fn_print_nl "${currentopt[index]}" | awk -F ';' '{ print NF }')
 			for ((currcmdindex = 1; currcmdindex <= currcmdamount; currcmdindex++)); do
 			for ((currcmdindex = 1; currcmdindex <= currcmdamount; currcmdindex++)); do
-				if [ "$(echo -e "${currentopt[index]}" | awk -F ';' -v x=${currcmdindex} '{ print $x }')" == "${getopt}" ]; then
+				if [ "$(fn_print_nl "${currentopt[index]}" | awk -F ';' -v x=${currcmdindex} '{ print $x }')" == "${getopt}" ]; then
 					# Run command.
 					# Run command.
 					eval "${currentopt[index + 1]}"
 					eval "${currentopt[index + 1]}"
 					# Exit should occur in modules. Should this not happen print an error
 					# Exit should occur in modules. Should this not happen print an error