1
0
mirror of https://github.com/RyanGreenup/cadmus.git synced 2025-08-19 04:12:16 +02:00

[TOOLS] Added Backlinks

This commit is contained in:
Ryan Greenup
2020-07-16 08:50:59 +10:00
parent 4c078f69aa
commit 55e51a402c
2 changed files with 28 additions and 7 deletions

19
bin/tools/List-Backlinks.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/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=$(xclip -selection clipboard -o | xargs basename | 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 {}"