Refactor: Verschachtelung im Ollama-Speicherort-Dialog reduziert

Der whiptail-Zweig verschachtelte vier Ebenen tief und verteilte drei
identische chosen="$default_path"-Zuweisungen über if/else-Paare, um
eine einzige lineare Entscheidung abzubilden. Die Ja/Nein-Abfrage und
der Eingabedialog folgen jetzt beide dem Guard-Clause-Muster
(if [[ -z "$chosen" ]]; then ... fi), das bereits für den CLI-Fallback
weiter unten in derselben Funktion verwendet wird.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017WMUd2fGsPCtTCVQkSS5TA
This commit is contained in:
2026-09-06 21:33:48 +02:00
co-authored by Claude Sonnet 5
parent 9278241dd0
commit 950eb5d361
+9 -15
View File
@@ -280,30 +280,24 @@ prompt_ollama_models_path() {
--yesno "Standard-Speicherort für Ollama-Modelle:\n\n$default_path\n\nMöchtest du diesen Speicherort verwenden?" \
12 70 || yesno_status=$?
if [[ "$yesno_status" -eq 0 || "$yesno_status" -eq 255 ]]; then
# Yes, or ESC/Cancel (255) - fall back to the configured
# default, consistent with the inputbox dialog below where
# ESC/Cancel also keeps the default instead of asking again.
# Yes, or ESC/Cancel (255) - use the configured default,
# consistent with the inputbox fallback below where an
# empty or cancelled dialog also keeps the default instead
# of asking again.
chosen="$default_path"
else
fi
if [[ -z "$chosen" ]]; then
local tui_tmp
tui_tmp="$(mktemp)"
if run_whiptail --output-fd 3 --title "Ollama KI-Modelle Speicherort" \
--inputbox "Bitte gib den Speicherort für die Ollama KI-Modelle an:" \
10 70 "$default_path" \
3> "$tui_tmp"; then
local tui_input
tui_input="$(sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' < "$tui_tmp")"
if [[ -n "$tui_input" ]]; then
chosen="$tui_input"
else
chosen="$default_path"
fi
else
# Dialog cancelled - fall back to the configured default
# instead of dropping into the CLI prompt below too.
chosen="$default_path"
chosen="$(sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' < "$tui_tmp")"
fi
rm -f "$tui_tmp"
[[ -z "$chosen" ]] && chosen="$default_path"
fi
fi