From ce134c0ebdaaa124c4a39c105d3afc0d730c78b2 Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Sat, 15 Jan 2022 10:00:44 -0600 Subject: [PATCH] Proper arg parsing for missing argument --- .profile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.profile b/.profile index 6364dc43..0c9405e0 100644 --- a/.profile +++ b/.profile @@ -143,11 +143,17 @@ fi Note() { mkdir -p "${NOTES_DIR}" + if [ -z "${1}" ]; then + echo "No note provided!" >&2 + return 1 + fi + local note_selection note_selection="${NOTES_DIR}/${2}.norg" case "${1}" in --open | -o) - nvim "${note_selection}" + # nvim "${note_selection}" + echo "${note_selection}" ;; --delete | -d) echo "${2}" @@ -159,7 +165,7 @@ Note() { done ;; *) - Note "open" "${1}" + Note "open" "${note_selection}" ;; esac