add function get_editor

This commit is contained in:
2025-09-26 13:43:52 +02:00
parent 5fa9a2c53f
commit 4c3a447579

View File

@@ -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 aus globaler config laden
EDITOR_CMD=$(get_editor_cmd)
# Datei im gewählten Editor öffnen
$EDITOR_CMD "$file"
else
whiptail --msgbox "Ungültige Datei ausgewählt." 10 60
fi
}
edit_project_registries() {