feat(notes): exit 1 w/ failues; wrap args in quotes to handle spaces

This commit is contained in:
Ayo Ayco 2025-08-24 10:35:52 +02:00
parent 99602f6529
commit aa812d6e0f

View file

@ -1,4 +1,4 @@
#! /usr/bin/bash
#!/usr/bin/bash
# Load config
. ${HOME}/ayo.conf
@ -26,7 +26,7 @@ function createNote() {
if [ "$title" = "" ]; then
echo "Title cannot be empty."
exit;
exit 1;
fi;
file_name=$title.md
@ -37,15 +37,16 @@ function createNote() {
install -Dv /dev/null "$full_path" >/dev/null
# TODO: update to correct heading from old entries
heading="# $title"
echo $heading > "$full_path"
echo "$heading" > "$full_path"
date_heading=$(date +'%b %d, %Y, %a %r')
echo $date_heading >> "$full_path"
echo "$date_heading" >> "$full_path"
fi
editFile "$full_path"
} || {
echo ">>> New note failed"
exit 1
}
}