0111d0fe7f264326d641e6a6c229e60017e2af5a
2 # remove eventually existing temp DB file
3 if [[ -f $TMPDB ]]; then
8 if [ "all" == "$NOTE" ]; then
9 echo "You're going to delete all notes."
10 read -r -p "Do you wish to continue? (y/N) " ANSWER
13 # shellcheck disable=SC2086
14 $JQ 'del(.notes[])' $DB > $TMPDB
15 # shellcheck disable=SC2086
17 # shellcheck disable=SC2086
19 echo "Deleted all notes"
22 echo "Aborting, no notes were deleted."
27 # shellcheck disable=SC2155
28 local OK
=$
(check_noteID
"$NOTE")
30 echo "invalid note \"$NOTE\""
31 echo "Use the note ID that you can fetch after listing your notes"
36 # shellcheck disable=SC2016,SC2086
37 TITLE
=$
($JQ --arg i
$OK '.notes[] | select(.id == $i) | .title' $DB)
38 # shellcheck disable=SC2016,SC2086
39 FILE
=$
($JQ -r --arg i
$OK '.notes[] | select(.id == $i) | .file' $DB)
41 # shellcheck disable=SC2016,SC2086
42 $JQ -r --arg i
$OK 'del(.notes[] | select(.id == $i))' $DB > $TMPDB
43 # shellcheck disable=SC2086
46 echo "Deleted note $TITLE"