mirror of
https://github.com/RyanGreenup/cadmus.git
synced 2025-08-22 13:42:52 +02:00
[Fix] makeLink now takes arguments not xclip, #1
This commit is contained in:
@@ -299,7 +299,7 @@ CadmusTools () {
|
||||
;;
|
||||
backlinks) shift; "${script_dir}/tools/List-Backlinks.sh" "${NOTES_DIR}" ${@:-} && exit 0
|
||||
;;
|
||||
link) shift; "${script_dir}/tools/LinkMarkdownNotes.sh" "${NOTES_DIR}" | CLIP_IN && exit 0
|
||||
link) shift; "${script_dir}/tools/LinkMarkdownNotes.sh" "${NOTES_DIR}" "$(CLIP_OUT)" | CLIP_IN && exit 0
|
||||
;;
|
||||
fix) shift; "${script_dir}/tools/fixLink.sh" "${NOTES_DIR}" && exit 0
|
||||
;;
|
||||
|
@@ -1,10 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
readonly script_name=$(basename "${0}")
|
||||
if [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
|
||||
echo "
|
||||
The input file is taken from the clipboard,
|
||||
choose the output file and a relative MD link
|
||||
will be generated"
|
||||
|
||||
echo " ${script_name} /path/to/dir input-file"
|
||||
echo "I should probably handle arguments more elegantly"
|
||||
exit 0
|
||||
|
||||
elif [[ $1 != '' ]]; then
|
||||
@@ -18,10 +17,9 @@ cd "${NOTES_DIR}"
|
||||
main() {
|
||||
|
||||
|
||||
command -v xclip >/dev/null 2>&1 || { echo >&2 "I require but it's not installed. It'll be in the repos, so, ~pacman -Syu xclip, aborting ."; exit 1; }
|
||||
|
||||
OUTPUTFILE=$(getNote_onlyShowFileName)
|
||||
INPUTFILE=$(xclip -o -selection clipboard)
|
||||
INPUTFILE="${2}"
|
||||
|
||||
REL_PATH=$(realpath --relative-to $(dirname $INPUTFILE) $OUTPUTFILE)
|
||||
## echo $REL_PATH | xclip -selection clipboard
|
||||
@@ -73,4 +71,4 @@ getNote_onlyShowFileName() {
|
||||
|
||||
}
|
||||
|
||||
main
|
||||
main "${@}"
|
||||
|
Reference in New Issue
Block a user