aboutsummaryrefslogtreecommitdiffstats
path: root/SOURCE/CORE/core-show.sh
blob: ac02c6b580d3df1cfaa4aa76448d8959b470ebb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
shownote() {
	NOTE=$1

	# shellcheck disable=SC2155
	local OK=$(check_noteID "$NOTE")
	if [ ! "$OK" ]; then
		echo "invalid note \"$NOTE\""
		echo "Use the note ID that you can fetch after listing your notes"
		exit 1
	fi

	FILE=$($JQ -r --arg i $OK '.notes[] | select(.id == $i) | .file' $DB)

	if [ "$FILE" ]; then
		$PAGER ${NOTESDIR}/${FILE}
	fi
}