1a04c8222e995d3e8260fb52dc3002ab4fc3d699
[bash-notes.git] / SOURCE / CORE / core-show.sh
1 function shownote() {
2 NOTE=$1
3
4 # shellcheck disable=SC2155
5 local OK=$(check_noteID "$NOTE")
6 if [ ! "$OK" ]; then
7 echo "invalid note \"$NOTE\""
8 echo "Use the note ID that you can fetch after listing your notes"
9 exit 1
10 fi
11
12 FILE=$($JQ -r --arg i $OK '.notes[] | select(.id == $i) | .file' $DB)
13
14 if [ "$FILE" ]; then
15 $PAGER ${NOTESDIR}/${FILE}
16 fi
17 }