From 3d151ed8578f214988c1be67f3b4fafa8ca37b59 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 17:28:51 -0600 Subject: [PATCH] testing --- functions/menu.sh | 89 +++++++++++++++++++++++++++++------------------ 1 file changed, 56 insertions(+), 33 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index 9c25d271..cef8c1d0 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -50,39 +50,62 @@ menu(){ script_path=$(dirname "$script") script_name="heavy_script.sh" cd "$script_path" || exit - clear -x - title - echo "Choose Your Update Type" - echo "-----------------------" - echo "1) -U | Update all applications, ignores versions" - echo "2) -u | Update all applications, does not update Major releases" - echo - echo "0) Exit" - echo - read -rt 600 -p "Please type the number associated with the flag above: " current_selection - if [[ $current_selection == 1 ]]; then - echo -e "\nHow many applications do you want updating at the same time?" - read -rt 600 -p "Please type an integer greater than 0: " up_async - elif [[ $current_selection == 2 ]]; then - echo -e "\nHow many applications do you want updating at the same time?" - read -rt 600 -p "Please type an integer greater than 0: " up_async - elif [[ $current_selection == 0 ]]; then - echo "Exiting.." - exit - else - echo "$current_selection was not an option, try again" - exit - fi - if [[ $up_async == 0 ]]; then - echo "0 was not an option.. exiting" - exit - elif ! [[ $up_async =~ ^[0-9]+$ ]]; then - echo "Error: \"$up_async\" is invalid, it needs to be an integer" - exit - else - update_selection+=("-u" "$up_async") - update_list+=("-u") - fi + while true + do + clear -x + title + echo "Choose Your Update Type" + echo "-----------------------" + echo "1) -U | Update all applications, ignores versions" + echo "2) -u | Update all applications, does not update Major releases" + echo + echo "0) Exit" + echo + read -rt 600 -p "Please type the number associated with the flag above: " current_selection + if [[ $current_selection == 1 ]]; then + echo -e "\nHow many applications do you want updating at the same time?" + read -rt 600 -p "Please type an integer greater than 0: " up_async + if [[ $up_async == 0 ]]; then + echo "Error: \"$up_async\" is less than 1" + echo "NOT adding it to the list" + sleep 5 + continue + elif ! [[ $up_async =~ ^[0-9]+$ ]]; then + echo "Error: \"$up_async\" is invalid, it needs to be an integer" + echo "NOT adding it to the list" + sleep 5 + continue + else + update_selection+=("-U" "$up_async") + update_list+=("-U") + break + fi + elif [[ $current_selection == 2 ]]; then + echo -e "\nHow many applications do you want updating at the same time?" + read -rt 600 -p "Please type an integer greater than 0: " up_async + if [[ $up_async == 0 ]]; then + echo "Error: \"$up_async\" is less than 1" + echo "NOT adding it to the list" + sleep 5 + continue + elif ! [[ $up_async =~ ^[0-9]+$ ]]; then + echo "Error: \"$up_async\" is invalid, it needs to be an integer" + echo "NOT adding it to the list" + sleep 5 + continue + else + update_selection+=("-u" "$up_async") + update_list+=("-u") + break + fi + elif [[ $current_selection == 0 ]]; then + echo "Exiting.." + exit + else + echo "$current_selection was not an option, try again" + exit + fi + done while true do clear -x