add function get_editor
This commit is contained in:
@@ -324,18 +324,29 @@ change_project_setting() {
|
|||||||
sed -i "s|^$key=.*|$key=$new_value|" "$config_file"
|
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)
|
# Projektdateien bearbeiten (Dateiauswahl + Editor)
|
||||||
edit_project_files() {
|
edit_project_files() {
|
||||||
local project=$1
|
local project=$1
|
||||||
local project_dir="$PROJECTS_DIR/$project"
|
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"
|
$EDITOR_CMD "$file"
|
||||||
else
|
|
||||||
whiptail --msgbox "Ungültige Datei ausgewählt." 10 60
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
edit_project_registries() {
|
edit_project_registries() {
|
||||||
|
|||||||
Reference in New Issue
Block a user