mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-13 02:24:27 +05:00
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:
@@ -43,53 +43,57 @@ 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[@]} ))")
|
||||
select_msg "Repo: ${repos[option]} Branch: ${branches[option]}"
|
||||
if [[ -d ${KLIPPER_DIR} ]]; then
|
||||
top_border
|
||||
echo -e "| ${red}!!! ATTENTION !!!${white} |"
|
||||
echo -e "| Existing Klipper folder found! Proceeding will remove | "
|
||||
echo -e "| the existing Klipper folder and replace it with a | "
|
||||
echo -e "| clean copy of the previously selected source repo! | "
|
||||
bottom_border
|
||||
|
||||
local yn
|
||||
while true; do
|
||||
read -p "${cyan}###### Proceed? (Y/n):${white} " yn
|
||||
case "${yn}" in
|
||||
Y|y|Yes|yes|"")
|
||||
select_msg "Yes"
|
||||
switch_klipper_repo "${repos[${option}]}" "${branches[${option}]}"
|
||||
set_custom_klipper_repo "${repos[${option}]}" "${branches[${option}]}"
|
||||
break;;
|
||||
N|n|No|no)
|
||||
select_msg "No"
|
||||
break;;
|
||||
*)
|
||||
error_msg "Invalid command!";;
|
||||
esac
|
||||
done
|
||||
else
|
||||
status_msg "Set custom Klipper repository to:\n ● Repository: ${repos[${option}]}\n ● Branch: ${branches[${option}]}"
|
||||
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)
|
||||
clear && print_header
|
||||
settings_menu
|
||||
break;;
|
||||
H|h)
|
||||
clear && print_header
|
||||
show_custom_klipper_repo_help
|
||||
break;;
|
||||
*)
|
||||
error_msg "Invalid command!";;
|
||||
esac
|
||||
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} |"
|
||||
echo -e "| Existing Klipper folder found! Proceeding will remove | "
|
||||
echo -e "| the existing Klipper folder and replace it with a | "
|
||||
echo -e "| clean copy of the previously selected source repo! | "
|
||||
bottom_border
|
||||
|
||||
local yn
|
||||
while true; do
|
||||
read -p "${cyan}###### Proceed? (Y/n):${white} " yn
|
||||
case "${yn}" in
|
||||
Y|y|Yes|yes|"")
|
||||
select_msg "Yes"
|
||||
switch_klipper_repo "${repos[${option}]}" "${branches[${option}]}"
|
||||
set_custom_klipper_repo "${repos[${option}]}" "${branches[${option}]}"
|
||||
break;;
|
||||
N|n|No|no)
|
||||
select_msg "No"
|
||||
break;;
|
||||
*)
|
||||
error_msg "Invalid command!";;
|
||||
esac
|
||||
done
|
||||
else
|
||||
status_msg "Set custom Klipper repository to:\n ● Repository: ${repos[${option}]}\n ● Branch: ${branches[${option}]}"
|
||||
set_custom_klipper_repo "${repos[${option}]}" "${branches[${option}]}"
|
||||
ok_msg "This repo will now be used for new Klipper installations!\n"
|
||||
fi
|
||||
|
||||
elif [[ ${option} =~ ${back} ]]; then
|
||||
clear && print_header
|
||||
settings_menu
|
||||
elif [[ ${option} =~ ${help} ]]; then
|
||||
clear && print_header
|
||||
show_custom_klipper_repo_help
|
||||
else
|
||||
error_msg "Invalid command!"
|
||||
fi
|
||||
done
|
||||
|
||||
change_klipper_repo_menu
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user