1
0
mirror of https://github.com/RyanGreenup/cadmus.git synced 2025-02-19 20:27:49 +01:00

Set up Tags, they're janky but they do work

This commit is contained in:
Ryan Greenup 2020-07-16 07:35:35 +10:00
parent 6828a3b64a
commit 2d4ba2dae4
3 changed files with 11 additions and 19 deletions

View File

@ -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"
;;

View File

@ -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
}

View File

@ -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?