This commit is contained in:
Sam Hardeman 2026-05-04 11:35:20 +02:00
commit 3c1a6e7374
2 changed files with 10 additions and 6 deletions

14
agenda
View file

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

2
editx
View file

@ -20,7 +20,7 @@ fi
touch "$1" touch "$1"
chmod +x "$1" chmod +x "$1"
daisy_editor "$1" daisy editor "$1"
if [[ ! -s "$1" && $existed -eq 0 ]]; then if [[ ! -s "$1" && $existed -eq 0 ]]; then
rm -f "$1" rm -f "$1"