feat: extract editor used into own env var

Keep the old (and now default) behavior as fallback.
This commit is contained in:
2023-11-14 17:14:45 +01:00
parent 83c5bac1c4
commit 6608feae99

4
agenda
View File

@@ -1,6 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail
AGENDA_EDITOR=${VISUAL:-${EDITOR:-vi}}
# The home of all files read and written by agenda.
#
# If this is left empty, this will default to the xdg user DOCUMENTS directory (in a
@@ -169,7 +171,7 @@ __edit() {
if [ "$opt_E" = "no" ]; then
export AGENDA_FILE="$file"
exec ${VISUAL:-${EDITOR:-vi}} "$file"
exec $AGENDA_EDITOR "$file"
else
echo "$file"
fi