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