diff --git a/bin/cadmus b/bin/cadmus index f561fea..7531649 100755 --- a/bin/cadmus +++ b/bin/cadmus @@ -135,21 +135,7 @@ function NoteSearch() { ## Only try and open something that is non-empty if [ "$FILES" != "" ]; then - ## xdg-open doesn't accept multiple arguments, so create commands and - ## pipe them back into bash This opens all files in the same tab with - ## VSCode and Atom The individual selections can also be passed off with - ## the keybindings to emacsclient. - # Using XDG-OPEN -# echo "${FILES}" | sed s/^/xdg-open\ \"/ | sed s/$/\"/ | bash - echo "${FILES}" | sed -e s+^+\"+ -e s+$+\"+ | xargs -n 1 xdg-open - -# # Getting the .desktop file and cutting off the Extension -# dex "$(xdg-mime query default text/markdown)" $FILES - # dex "$(xdg-mime query default text/markdown)" $FILES - ## This might break if the .desktop file doesn't have the same - ## name as the binary. - ## This appears to be a standard though - ## https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#file-naming + echo "${FILES}" | sed -e s+^+\"+ -e s+$+\"+ | xargs -n 1 xdg-open fi } @@ -162,9 +148,10 @@ CadmusTags () { while test $# -gt 0 do case "$1" in - filter) shift; NoteFind "${NOTES_DIR}" "${@:-}" + filter) shift; "${script_dir}/tags/FilterNotesByTMSUTag.sh" "${NOTES_DIR}" "${@:-}" ;; - create) shift; tags-to-TMSU.sh "${NOTES_DIR}" ${@:-} && exit 0 + create) shift; "${script_dir}/tags/tags-to-TMSU.sh" "${NOTES_DIR}" ${@:-} && exit 0 + ./ ;; --*) >&2 echo "bad option $1" ;; diff --git a/bin/tags/FilterNotesByTMSUTag.sh b/bin/tags/FilterNotesByTMSUTag.sh index 291d8d1..6c7567a 100755 --- a/bin/tags/FilterNotesByTMSUTag.sh +++ b/bin/tags/FilterNotesByTMSUTag.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash - +readonly script_name=$(basename "${0}") +readonly script_dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +readonly NOTES_DIR="$HOME/Notes/MD/notes" function main() { @@ -42,7 +44,7 @@ r :: regenerate Tags" read -d '' -s -n1 continueQ if [ "$continueQ" == "r" ]; then - ~/bin/tags-to-TMSU.sh + "${script_dir}/tags-to-TMSU.sh" "${NOTES_DIR}" ${@:-} && exit 0 exit 0 ## Must Exit because it won't find the tags without restarting. fi } diff --git a/todo.org b/todo.org index e6e5cd6..9c3893e 100644 --- a/todo.org +++ b/todo.org @@ -66,6 +66,9 @@ Take the command query and change white spaces into =|= characters, this way sea * TODO [#A] tags ** TODO Standardise These desperately need to be standardised like search and NoteFind have been +** TODO Move the scripts into PATH +Currently all the tag scripts call a relative script, not in the PATH, maybe this is actually OK? it means 0 install... + * TODO [#A] tools ** Link Markdown Notes Should this do grep or recoll?