diff --git a/scripts/image-builder.sh b/scripts/image-builder.sh index 656099d..3ea82ac 100755 --- a/scripts/image-builder.sh +++ b/scripts/image-builder.sh @@ -324,18 +324,29 @@ change_project_setting() { sed -i "s|^$key=.*|$key=$new_value|" "$config_file" } +# Editor aus global config auslesen +get_editor_cmd() { + if [[ -f "$GLOBAL_CONFIG" ]]; then + jq -r '.editor // "nano"' "$GLOBAL_CONFIG" + else + echo "nano" + fi +} + # Projektdateien bearbeiten (Dateiauswahl + Editor) edit_project_files() { local project=$1 local project_dir="$PROJECTS_DIR/$project" + [ ! -d "$project_dir" ] && { whiptail --msgbox "Projektordner nicht gefunden." 10 60; return; } - file=$(dialog --stdout --title "Datei auswählen" --fselect "$project_dir/" 20 70) || return + # Datei auswählen + file=$(whiptail --title "Datei auswählen" --fselect "$project_dir/" 20 70 3>&1 1>&2 2>&3) || return - if [ -f "$file" ]; then - $EDITOR_CMD "$file" - else - whiptail --msgbox "Ungültige Datei ausgewählt." 10 60 - fi + # Editor aus globaler config laden + EDITOR_CMD=$(get_editor_cmd) + + # Datei im gewählten Editor öffnen + $EDITOR_CMD "$file" } edit_project_registries() {