Improve runner_delete

Sanity check and rename variable
This commit is contained in:
the-sane 2020-12-27 14:48:38 -05:00 committed by GitHub
parent 20eb8e984a
commit 32fdc04ec7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -659,10 +659,17 @@ lutris_restart() {
# Delete the selected runner # Delete the selected runner
runner_delete() { runner_delete() {
remove_option="$1" # This function expects an index number for the array installed_runners to be passed in as an argument
if message question "Are you sure you want to delete the following runner?\n\n${installed_runners[$remove_option]}"; then if [ -z "$1" ]; then
rm -r "${installed_runners[$remove_option]}" echo -e "\nScript error: The runner_delete function expects an argument. Aborting."
echo -e "\nDeleted ${installed_runners[$remove_option]}\n" read -n 1 -s -p "Press any key..."
exit 0
fi
runner_to_delete="$1"
if message question "Are you sure you want to delete the following runner?\n\n${installed_runners[$runner_to_delete]}"; then
rm -r "${installed_runners[$runner_to_delete]}"
echo -e "\nDeleted ${installed_runners[$runner_to_delete]}\n"
fi fi
# Restart Lutris # Restart Lutris
@ -705,7 +712,7 @@ runner_select_delete() {
runner_install() { runner_install() {
# This function expects an index number for the array runner_versions to be passed in as an argument # This function expects an index number for the array runner_versions to be passed in as an argument
if [ -z "$1" ]; then if [ -z "$1" ]; then
echo -e "\nScript error: The install runner function expects an argument. Aborting." echo -e "\nScript error: The runner_install function expects an argument. Aborting."
read -n 1 -s -p "Press any key..." read -n 1 -s -p "Press any key..."
exit 0 exit 0
fi fi
@ -741,7 +748,7 @@ runner_install() {
runner_select_install() { runner_select_install() {
# This function expects the name of the runner contributor to be passed in as an argument # This function expects the name of the runner contributor to be passed in as an argument
if [ -z "$1" ]; then if [ -z "$1" ]; then
echo -e "\nScript error: The choose runner function expects an argument. Aborting." echo -e "\nScript error: The runner_select_install function expects an argument. Aborting."
read -n 1 -s -p "Press any key..." read -n 1 -s -p "Press any key..."
exit 0 exit 0
fi fi