Selaa lähdekoodia

Changes to the UI

more to come soon
Daniel Gibbs 9 vuotta sitten
vanhempi
commit
a84ba451aa

+ 8 - 10
lgsm/functions/command_mods_install.sh

@@ -6,35 +6,33 @@
 # Description: List and installs available mods along with mods_list.sh and mods_core.sh.
 
 local commandname="MODS"
-local commandaction="Mod Installation"
+local commandaction="addons/mods"
 local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 
 check.sh
 mods_core.sh
 
 fn_mods_install_init(){
+	fn_print_header
 	# Display installed mods
 	fn_installed_mods_light_list
-	fn_script_log "Entering mods & addons installation"
-	echo "================================="
-	echo "${gamename} mods & addons installation"
 	echo ""
+	echo "Available addons/mods"
+	echo "================================="
+	
 	# Display available mods from mods_list.sh
 	fn_mods_show_available
 	echo ""
 	# Keep prompting as long as the user input doesn't correspond to an available mod
 	while [[ ! " ${availablemodscommands[@]} " =~ " ${usermodselect} " ]]; do
-			echo -en "Enter a \e[36mmod\e[0m to install (or exit to abort): "
+			echo -en "Enter an ${cyan}addon/mod${default} to ${green}install${default} (or exit to abort): "
 			read -r usermodselect
 			# Exit if user says exit or abort
 			if [ "${usermodselect}" == "exit" ]||[ "${usermodselect}" == "abort" ]; then
-					fn_script_log "User aborted."
-					echo "Aborted."
 					core_exit.sh
 			# Supplementary output upon invalid user input 
 			elif [[ ! " ${availablemodscommands[@]} " =~ " ${usermodselect} " ]]; then
-				fn_print_error2_nl "${usermodselect} is not a valid mod."
-				echo " * Enter a valid mod or input exit to abort."
+				fn_print_error2_nl "${usermodselect} is not a valid addon/mod."
 			fi
 	done
 	# Gives a pretty name to the user and get all mod info
@@ -77,7 +75,7 @@ fn_mod_installation(){
 		fn_print_ok_nl "${modprettyname} installed"
 		fn_script_log "${modprettyname} installed."
 	else
-		fn_print_fail "No mod was selected"
+		fn_print_fail "No addon/mod was selected"
 		exitcode="1"
 		core_exit.sh
 	fi

+ 19 - 16
lgsm/functions/command_mods_remove.sh

@@ -6,16 +6,16 @@
 # Description: Uninstall mods along with mods_list.sh and mods_core.sh.
 
 local commandname="MODS"
-local commandaction="Mod Remove"
+local commandaction="addons/mods"
 local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 
 check.sh
 mods_core.sh
 
 fn_mods_remove_init(){
-	fn_script_log "Entering mods & addons removal"
+	fn_print_header
+	echo "Remove addons/mods"
 	echo "================================="
-	echo "${gamename} mods & addons removal"
 	# A simple function to exit if no mods were installed
 	# Also returns ${installedmodscount} if mods were found
 	fn_mods_exit_if_not_installed
@@ -25,19 +25,26 @@ fn_mods_remove_init(){
 	echo ""
   	# Keep prompting as long as the user input doesn't correspond to an available mod
 	while [[ ! " ${installedmodslist[@]} " =~ " ${usermodselect} " ]]; do
-		echo -en "Enter a \e[36mmod\e[0m to \e[31mremove\e[0m (or exit to abort): "
+		echo -en "Enter a ${cyan}mod${default} to ${red}remove${default} (or exit to abort): "
 		read -r usermodselect
 		# Exit if user says exit or abort
 		if [ "${usermodselect}" == "exit" ]||[ "${usermodselect}" == "abort" ]; then
-			fn_script_log "User aborted."
-			echo "Aborted."
-			core_exit.sh
-			# Supplementary output upon invalid user input 
-		elif [[ ! " ${installedmodslist[@]} " =~ " ${usermodselect} " ]]; then
-				fn_print_error2_nl "${usermodselect} is not a valid mod."
-				echo " * Enter a valid mod or input exit to abort."
+				core_exit.sh
+		# Supplementary output upon invalid user input 
+		elif [[ ! " ${availablemodscommands[@]} " =~ " ${usermodselect} " ]]; then
+			fn_print_error2_nl "${usermodselect} is not a valid addon/mod."
 		fi
 	done
+	fn_print_warning_nl "You are about to remove ${usermodselect}."
+	echo " * Any custom files/configuration will be removed."
+	while true; do
+		read -e -i "y" -p "Continue? [Y/n]" yn
+		case $yn in
+		[Yy]* ) break;;
+		[Nn]* ) echo Exiting; exit;;
+		* ) echo "Please answer yes or no.";;
+	esac
+	done	
 	# Gives a pretty name to the user and get all mod info
 	currentmod="${usermodselect}"
 	fn_mod_get_info_from_command
@@ -45,17 +52,13 @@ fn_mods_remove_init(){
 	fn_check_files_list
 	fn_script_log "Removing ${modsfilelistsize} files from ${modprettyname}"
 	fn_print_dots "Removing ${modsfilelistsize} files from ${modprettyname}"
-	echo ""
-	echo " * Any mod's custom file will be deleted."
-	echo " * Press ctrl + c to abort."
-	sleep 4
 }
 
 # Uninstall the mod
 fn_mod_remove_process(){
 	# Go through every file and remove it
 	modfileline="1"
-	while [ $modfileline -le $modsfilelistsize ]; do
+	while [ "${modfileline}" -le "${modsfilelistsize}" ]; do
 		# Current line defines current file to remove
 		currentfileremove="$(sed "${modfileline}q;d" "${modsdatadir}/${modcommand}-files.list")"
 		# If file or directory exists, then remove it

+ 12 - 12
lgsm/functions/mods_core.sh

@@ -6,7 +6,7 @@
 # Description: Core functions for mods list/install/update/remove
 
 local commandname="MODS"
-local commandaction="Core functions for mods"
+local commandaction="addons/mods"
 local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
 
 ## Useful variables
@@ -416,8 +416,8 @@ fn_mods_show_available(){
 		displayedmodsite="${compatiblemodslist[compatiblemodslistindex+2]}"
 		displayedmoddescription="${compatiblemodslist[compatiblemodslistindex+3]}"
 		# Output mods to the user
-		echo -e "\e[1m${displayedmodname}\e[0m - ${displayedmoddescription} - ${displayedmodsite}"
-		echo -e " * \e[36m${displayedmodcommand}\e[0m"
+		echo -e "\e[1m${displayedmodname}${default} - ${displayedmoddescription} - ${displayedmodsite}"
+		echo -e " * ${cyan}${displayedmodcommand}${default}"
 		# Increment index from the amount of values we just displayed
 		let "compatiblemodslistindex+=4"
 	done
@@ -483,8 +483,8 @@ fn_installed_mods_detailed_list(){
 		# Get mod info
 		fn_mod_get_info_from_command
 		# Display mod info to the user
-		echo -e "\e[1m${modprettyname}\e[0m - ${moddescription} - ${modsite}"
-		echo -e " * \e[36m${modcommand}\e[0m"
+		echo -e "\e[1m${modprettyname}${default} - ${moddescription} - ${modsite}"
+		echo -e " * ${cyan}${modcommand}${default}"
 	done
 }
 
@@ -501,7 +501,7 @@ fn_installed_mods_medium_list(){
 		# Get mod info
 		fn_mod_get_info_from_command
 		# Display mod info to the user
-		echo -e "\e[36m${modcommand}\e[0m - \e[1m${modprettyname}\e[0m - ${moddescription}"
+		echo -e "${cyan}${modcommand}${default} - \e[1m${modprettyname}${default} - ${moddescription}"
 	done
 }
 
@@ -512,8 +512,8 @@ fn_installed_mods_light_list(){
 	fn_check_installed_mods
 	fn_mods_available_commands_from_installed
 	if [ $installedmodscount -gt 0 ]; then
+		echo "Installed addons/mods"
 		echo "================================="
-		echo "Installed mods/addons"
 		# Were now based on ${installedmodslist} array's values
 		# We're gonna go through all available commands, get details and display them to the user
 		for ((llindex=0; llindex < ${#installedmodslist[@]}; llindex++)); do
@@ -522,7 +522,7 @@ fn_installed_mods_light_list(){
 			# Get mod info
 			fn_mod_get_info_from_command
 			# Display simple mod info to the user
-			echo -e " * \e[1m${modprettyname}\e[0m"
+			echo -e " * \e[1m${green}${modprettyname}${default}${default}"
 		done
 	fi
 }
@@ -533,7 +533,7 @@ fn_installed_mods_update_list(){
 	fn_check_installed_mods
 	fn_mods_available_commands_from_installed
 	echo "================================="
-	echo "Installed mods/addons"
+	echo "Installed addons/mods"
 	# Were now based on ${installedmodslist} array's values
 	# We're gonna go through all available commands, get details and display them to the user
 	for ((ulindex=0; ulindex < ${#installedmodslist[@]}; ulindex++)); do
@@ -550,12 +550,12 @@ fn_installed_mods_update_list(){
 			core_exit.sh
 		# If the mod won't get updated
 		elif [ "${modkeepfiles}" == "NOUPDATE" ]; then
-			echo -e " * \e[31m${modprettyname}\e[0m (won't be updated)"
+			echo -e " * \e[31m${modprettyname}${default} (won't be updated)"
 		# If the mode is just overwritten
 		elif [ "${modkeepfiles}" == "OVERWRITE" ]; then
-			echo -e " * \e[1m${modprettyname}\e[0m (overwrite)"
+			echo -e " * \e[1m${modprettyname}${default} (overwrite)"
 		else			
-			echo -e " * \e[33m${modprettyname}\e[0m (common custom files remain untouched)"
+			echo -e " * \e[33m${modprettyname}${default} (common custom files remain untouched)"
 		fi
 	done
 }