From 1d96d28f21690f00e56f60a08d5d0713e95d2c60 Mon Sep 17 00:00:00 2001 From: Ayo Date: Mon, 29 Jun 2026 13:19:36 +0200 Subject: [PATCH] feat(notes): use date if title is empty --- notes.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/notes.sh b/notes.sh index 6377490..a565472 100755 --- a/notes.sh +++ b/notes.sh @@ -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