feat(notes): use date if title is empty

This commit is contained in:
ayo 2026-06-29 13:19:36 +02:00
parent 3c304c5452
commit 1d96d28f21

View file

@ -14,14 +14,16 @@ function createNote() {
title="${@:1}"
fi
file_date="$(date +'%m.%d.%Y')"
if [ "$title" = "" ]; then
echo "Title cannot be empty."
exit 1;
title="$file_date"
file_name="${file_date}.md"
else
file_name="${file_date}-${title}.md"
fi;
file_date="$(date +'%m.%d.%Y')"
file_name="$title.md"
full_path="${notes_dir}/${file_date}-${file_name}"
full_path="${notes_dir}/${file_name}"
# IF Not Exists: create file with:
# - title