diff options
author | Matthew Lemon <y@yulqen.org> | 2023-03-29 11:28:19 +0100 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2023-03-29 11:28:19 +0100 |
commit | ba0614ba4766962c0e0f9b18837fada032f84936 (patch) | |
tree | 3f67bf99938f93805ef22f4d9a0b3fe44608357e /tj-alternate.sh | |
parent | f23534c23177274c7c8601808fb4c7e6cfc2344b (diff) |
better tj scripts - can now divert to work-related directory
Diffstat (limited to 'tj-alternate.sh')
-rwxr-xr-x | tj-alternate.sh | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/tj-alternate.sh b/tj-alternate.sh index 1ae03f4..e6dd16d 100755 --- a/tj-alternate.sh +++ b/tj-alternate.sh @@ -3,8 +3,33 @@ # This script replaces the _tj as the main functionality of the tj fish function, as wash. We don't need # the fish function any more - this does the job. -# Our target file -TODAY_JOURNAL=~/Documents/Notes/journal/$(date +\%Y-\%m-\%d).md + +# Here we are allowed to pass the -m flag to send the output to a different journal - one for work. +DEFAULT_JOURNAL=~/Documents/Notes/journal/home/$(date +\%Y-\%m-\%d).md +USE_CUSTOM_JOURNAL=false + +while getopts "m" opt; do + case $opt in + m) + USE_CUSTOM_JOURNAL=true + ;; + \?) + echo "Invalid option: -$OPTARG" >&2 + exit 1 + ;; + esac +done + +shift $((OPTIND-1)) + +# Set TODAY_JOURNAL to the default value or the custom value depending on the flag +if [ "$USE_CUSTOM_JOURNAL" = true ]; then + TODAY_JOURNAL=~/Documents/Notes/journal/work/MOD-$(date +\%Y-\%m-\%d).md +else + TODAY_JOURNAL="$DEFAULT_JOURNAL" +fi + + # Test whether it already exisits or not if [[ -a $TODAY_JOURNAL ]] |