fix(klipper): reset input variable by assigning empty string

Signed-off-by: Dominik Willner <th33xitus@gmail.com>
This commit is contained in:
th33xitus
2022-11-13 11:12:40 +01:00
parent 8d9a4fb916
commit d0116734f2

View File

@@ -61,11 +61,11 @@ function start_klipper_setup() {
read -p "${cyan}###### Select Python version:${white} " input read -p "${cyan}###### Select Python version:${white} " input
case "${input}" in case "${input}" in
1) 1)
select_msg "Python 2.7" select_msg "Python 2.7\n"
python_version=2 python_version=2
break;; break;;
2) 2)
select_msg "Python 3.x" select_msg "Python 3.x\n"
python_version=3 python_version=3
break;; break;;
B|b) B|b)
@@ -73,7 +73,7 @@ function start_klipper_setup() {
*) *)
error_msg "Invalid Input!\n";; error_msg "Invalid Input!\n";;
esac esac
done done && input=""
### user selection for instance count ### user selection for instance count
print_dialog_user_select_instance_count print_dialog_user_select_instance_count
@@ -83,14 +83,14 @@ function start_klipper_setup() {
if [[ ${input} =~ ${regex} ]]; then if [[ ${input} =~ ${regex} ]]; then
instance_count="${input}" instance_count="${input}"
select_msg "Instance count: ${instance_count}" select_msg "Instance count: ${instance_count}\n"
break break
elif [[ ${input} == "B" || ${input} == "b" ]]; then elif [[ ${input} == "B" || ${input} == "b" ]]; then
install_menu install_menu
else else
error_msg "Invalid Input!\n" error_msg "Invalid Input!\n"
fi fi
done done && input=""
### user selection for custom names ### user selection for custom names
use_custom_names="false" use_custom_names="false"
@@ -100,18 +100,18 @@ function start_klipper_setup() {
read -p "${cyan}###### Assign custom names? (y/N):${white} " input read -p "${cyan}###### Assign custom names? (y/N):${white} " input
case "${input}" in case "${input}" in
Y|y|Yes|yes) Y|y|Yes|yes)
select_msg "Yes" select_msg "Yes\n"
use_custom_names="true" use_custom_names="true"
break;; break;;
N|n|No|no|"") N|n|No|no|"")
select_msg "No" select_msg "No\n"
break;; break;;
B|b) B|b)
clear; install_menu; break;; clear; install_menu; break;;
*) *)
error_msg "Invalid Input!";; error_msg "Invalid Input!\n";;
esac esac
done done && input=""
else else
instance_names+=("printer") instance_names+=("printer")
fi fi
@@ -126,14 +126,14 @@ function start_klipper_setup() {
read -p "${cyan}###### Name for instance #${i}:${white} " input read -p "${cyan}###### Name for instance #${i}:${white} " input
if [[ ${input} =~ ${regex} ]]; then if [[ ${input} =~ ${regex} ]]; then
select_msg "Name: ${input}" select_msg "Name: ${input}\n"
#TODO: if input is only a number, we need to rewrite it here already and prefix it with 'printer_'! #TODO: if input is only a number, we need to rewrite it here already and prefix it with 'printer_'!
instance_names+=("${input}") instance_names+=("${input}")
i=$(( i + 1 )) i=$(( i + 1 ))
else else
error_msg "Invalid Input!" error_msg "Invalid Input!\n"
fi fi
done && unset input done && input=""
else else
for (( i=1; i <= instance_count; i++ )); do for (( i=1; i <= instance_count; i++ )); do
instance_names+=("printer_${i}") instance_names+=("printer_${i}")