aa9d451b4998cc2c2b9438283ee3c0aa0dad50c6
2 # remove eventually existing temp DB file
3 if [[ -f $TMPDB ]]; then
8 echo "adding new note - \"$NOTETITLE\""
9 # shellcheck disable=SC2086
10 LASTID
=$
($JQ '.notes[-1].id // 0 | tonumber' $DB)
11 # [ "" == $LASTID ] && LASTID=0
12 NOTEID
=$
(( LASTID
+ 1 ))
13 # shellcheck disable=SC2086
14 touch ${NOTESDIR}/${NOW}
15 # shellcheck disable=SC2016
16 $JQ --arg i
"$NOTEID" --arg t
"$NOTETITLE" --arg f
"$NOW" '.notes += [{"id": $i, "title": $t, "file": $f}]' "$DB" > $TMPDB
17 # shellcheck disable=SC2086
19 # example for alacritty:
20 # alacritty --class notes --title notes -e /usr/bin/vim ...
21 # shellcheck disable=SC2086,SC2091
22 $
(${TERMINAL} ${TERM_OPTS} ${EDITOR} ${NOTESDIR}/${NOW})