From b131cf56ef266c7a31a840956b3bc52362eae1cb Mon Sep 17 00:00:00 2001 From: coderus Date: Fri, 6 Jan 2023 15:46:51 +0100 Subject: [PATCH] refactor(klipper): confirm instalaltion to existing instance folder --- scripts/klipper.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/scripts/klipper.sh b/scripts/klipper.sh index 55c0649..ecfde5f 100644 --- a/scripts/klipper.sh +++ b/scripts/klipper.sh @@ -123,11 +123,22 @@ function start_klipper_setup() { if [[ ${input} =~ ${regex} ]]; then select_msg "Name: ${input}\n" + local instance_name if [[ ${input} =~ ^[0-9]+$ ]]; then - instance_names+=("printer_${input}") + instance_name="printer_${input}" else - instance_names+=("${input}") + instance_name="${input}" fi + if [[ -d "${HOME}/${instance_name}_data" ]] + then + status_msg "Instance ${instance_name} already exists" + read -p "${cyan}###### Enter q for exit or any other input to continue:${white} " same_continue + if [[ "${same_continue}" == "q" ]] + then + return + fi + fi + instance_names+=("${instance_name}") i=$(( i + 1 )) else error_msg "Invalid Input!\n"