aboutsummaryrefslogtreecommitdiffstats
path: root/SOURCE/CORE/core-show.sh
diff options
context:
space:
mode:
authordanix <danix@danix.xyz>2023-03-29 11:19:55 +0200
committerdanix <danix@danix.xyz>2023-03-29 11:19:55 +0200
commitfb71118327216a21f6732161dc3721496a16370d (patch)
tree96eddf131b1d802be87addd7faece45141e98a9a /SOURCE/CORE/core-show.sh
parentad818a9d1e26462bfb0c36d585dcbc33b38b37ca (diff)
downloadbash-notes-fb71118327216a21f6732161dc3721496a16370d.tar.gz
bash-notes-fb71118327216a21f6732161dc3721496a16370d.zip
Separated script into multiple files for easier management. Added Makefile
Diffstat (limited to 'SOURCE/CORE/core-show.sh')
-rw-r--r--SOURCE/CORE/core-show.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/SOURCE/CORE/core-show.sh b/SOURCE/CORE/core-show.sh
new file mode 100644
index 0000000..1a04c82
--- /dev/null
+++ b/SOURCE/CORE/core-show.sh
@@ -0,0 +1,17 @@
+function 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
+}