feat(notes): use date if title is empty
This commit is contained in:
parent
3c304c5452
commit
1d96d28f21
1 changed files with 7 additions and 5 deletions
12
notes.sh
12
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
|
||||
|
|
|
|||
Loading…
Reference in a new issue