mirror of
https://github.com/RyanGreenup/cadmus.git
synced 2025-08-12 00:54:27 +02:00
tags-to-tmsu now calles JS relative to script dir.
This commit is contained in:
@@ -1,11 +1,14 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
readonly script_name=$(basename "${0}")
|
||||||
|
script_dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||||
|
readonly script_dir=$(realpath "${script_dir}""/""${script_name}" | xargs dirname)
|
||||||
|
|
||||||
if [[ $1 != '' ]]; then
|
if [[ $1 != '' ]]; then
|
||||||
NOTE_DIR=$1
|
NOTE_DIR=$1
|
||||||
else
|
else
|
||||||
NOTE_DIR='./'
|
NOTE_DIR='./'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd "${NOTE_DIR}"
|
|
||||||
|
|
||||||
main () {
|
main () {
|
||||||
|
|
||||||
@@ -36,11 +39,14 @@ if [ $choice == 'y' ]; then
|
|||||||
## Make a File in /tmp/00tags.sh listing the tmsu commands to run
|
## Make a File in /tmp/00tags.sh listing the tmsu commands to run
|
||||||
## Rscript ~/bin/YamltoTMSU.R $NOTE_DIR ## Assumption that RScript is in ~/bin
|
## Rscript ~/bin/YamltoTMSU.R $NOTE_DIR ## Assumption that RScript is in ~/bin
|
||||||
|
|
||||||
## ALL THE DIRECTORIES MUST LINE UP!!
|
## Must be run from the directory of the notes
|
||||||
node ./yaml-tags-to-TMSU.js $NOTE_DIR 2>/dev/null >> /tmp/00tags.sh
|
## because the commands are piped back into bash, bash
|
||||||
## Change into the notes dir and run those commands
|
## will operate relative to the working directory of the script
|
||||||
cd $NOTE_DIR
|
cd $NOTE_DIR
|
||||||
bash /tmp/00tags.sh
|
|
||||||
|
## Must call the node script from this directory by using $script_dir
|
||||||
|
## Or assume that it is in the path.
|
||||||
|
node "${script_dir}"/yaml-tags-to-TMSU.js "${NOTE_DIR}" 2>/dev/null | bash
|
||||||
|
|
||||||
elif [ $choice == 't' ]; then
|
elif [ $choice == 't' ]; then
|
||||||
echo "Option $choice selected" #FIXME
|
echo "Option $choice selected" #FIXME
|
||||||
@@ -56,12 +62,10 @@ elif [ $choice == 'b' ]; then
|
|||||||
## Implement HashTags
|
## Implement HashTags
|
||||||
hashtags $NOTE_DIR | bash
|
hashtags $NOTE_DIR | bash
|
||||||
|
|
||||||
## Implement YAML Tags
|
## Implement YAML Tags (see option Y for comments, this is copy/paste)
|
||||||
## Rscript ~/bin/YamltoTMSU.R $NOTE_DIR ## Assumption that RScript is in ~/bin
|
|
||||||
|
|
||||||
node ./yaml-tags-to-TMSU.js $NOTE_DIR 2>/dev/null >> /tmp/00tags.sh
|
|
||||||
cd $NOTE_DIR
|
cd $NOTE_DIR
|
||||||
bash /tmp/00tags.sh
|
node "${script_dir}"/yaml-tags-to-TMSU.js "${NOTE_DIR}" 2>/dev/null | bash
|
||||||
|
|
||||||
elif [ $choice == 'n' ]; then
|
elif [ $choice == 'n' ]; then
|
||||||
echo "Option $choice selected" #FIXME
|
echo "Option $choice selected" #FIXME
|
||||||
cd $NOTE_DIR
|
cd $NOTE_DIR
|
||||||
|
Reference in New Issue
Block a user