Some small bug fixes that ensure the agenda script runs error-free on subsequent calls. Also a small fix to "editx" so the correct daisy command is used.

Deletion of the old daisy file.
This commit is contained in:
Lea 2026-04-04 14:35:44 +02:00
parent 6737d1ca15
commit 3b72111477
3 changed files with 10 additions and 357 deletions

14
agenda
View file

@ -24,11 +24,15 @@ if [[ $1 == '' ]]; then
exit 1
fi
root_dir=$(dirname $1)/.daisy/$(basename $1)
today_sym=$1
dir=$(realpath -s "$1")
parent_dir=$(dirname "$dir")
name=$(basename "$dir")
root_dir="$parent_dir/.daisy/$name"
today_sym="$dir"
# Present day
read year month day < <(date "+%Y %m %d")
today="$root_dir/$year/$month/$day"
set -e
@ -50,7 +54,7 @@ trap errorFn ERR
test -e "$root_dir" && find "$root_dir" -maxdepth 3 -type d -empty -delete
# Now we can set up today's directory
mkdir -p "$root_dir/$year/$month/$day"
ln -sf "$root_dir/$year/$month/$day" "$today_sym"
ln -s "$root_dir" "$today_sym/.tree"
mkdir -p "$today"
ln -snf "$today" "$today_sym"
ln -snf "$root_dir" "$dir/.tree"
exitcode=$?