1
0
mirror of https://github.com/RyanGreenup/cadmus.git synced 2025-08-24 14:42:55 +02:00
Files
cadmus/bin/tools/List-Backlinks.sh
ryangreenup 6905388d27 [FIX] List BackLinks now takes STDIN/STDOUT #1
This means that the xclip used will be governed by cadmus making it more
cross platform
2020-07-24 01:21:20 +10:00

20 lines
763 B
Bash
Executable File

#!/usr/bin/env bash
command -v rg >/dev/null 2>&1 || { echo >&2 "I require ripgrep but it's not installed. Aborting."; exit 1; }
command -v sd >/dev/null 2>&1 || { echo >&2 "I require sd (sed replacement) but it's not installed. Aborting."; exit 1; }
command -v xclip >/dev/null 2>&1 || { echo >&2 "I require xclip but it's not installed. Aborting."; exit 1; }
term=$(basename "${1}" | cut -f 1 -d '.')
rg -e "\[.*\]\(.*$term\.md\)" -e "\[\[$term\]\]" -e "\[\[$term.*\]\]" \
~/Notes/MD/notes \
-t markdown -ol
## If you want to preview the Backlinks
## rg -e "\[.*\]\(.*$term\.md\)" -e "\[\[$term\]\]" -e "\[\[$term.*\]\]" \
## ~/Notes/ -t markdown -ol \
## fzf --bind pgup:preview-page-up,pgdn:preview-page-down --preview "mdcat {}"