fix(switch_klipper_repo): use of case didn't allow selections of 2 and above

Signed-off-by: Dominik Willner <th33xitus@gmail.com>
This commit is contained in:
th33xitus
2022-09-10 20:25:05 +02:00
parent f25726cfed
commit 9d90daec7f

View File

@@ -43,11 +43,16 @@ function change_klipper_repo_menu() {
back_help_footer
local option
local num="^[0-9]+$"
local back="^(B|b)$"
local help="^(H|h)$"
while true; do
read -p "${cyan}###### Perform action:${white} " option
case "${option}" in
0 | "$(( option < ${#repos[@]} ))")
if [[ ${option} =~ ${num} && ${option} -lt ${#repos[@]} ]]; then
select_msg "Repo: ${repos[option]} Branch: ${branches[option]}"
if [[ -d ${KLIPPER_DIR} ]]; then
top_border
echo -e "| ${red}!!! ATTENTION !!!${white} |"
@@ -77,19 +82,18 @@ function change_klipper_repo_menu() {
set_custom_klipper_repo "${repos[${option}]}" "${branches[${option}]}"
ok_msg "This repo will now be used for new Klipper installations!\n"
fi
break;;
B|b)
elif [[ ${option} =~ ${back} ]]; then
clear && print_header
settings_menu
break;;
H|h)
elif [[ ${option} =~ ${help} ]]; then
clear && print_header
show_custom_klipper_repo_help
break;;
*)
error_msg "Invalid command!";;
esac
else
error_msg "Invalid command!"
fi
done
change_klipper_repo_menu
}