aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2023-03-16 16:51:54 +0000
committerMatthew Lemon <y@yulqen.org>2023-03-16 16:53:36 +0000
commitc637e3f03013d4010434c21eef7d7a95280810fe (patch)
tree57d91e5263a84d519134f868b8d01efeae97ed83
parentcd148eb7d5d283e8f104289439c097b0b0d357f1 (diff)
This is a replacement for _tj script
The _tj script relied on passing a string of text as standard input. This replaces the old tj.fish function which used _tj to do the job of "tj 'a message for the journal'.
-rwxr-xr-xtj-alternate.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/tj-alternate.sh b/tj-alternate.sh
new file mode 100755
index 0000000..1ae03f4
--- /dev/null
+++ b/tj-alternate.sh
@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+
+# 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
+
+# Test whether it already exisits or not
+if [[ -a $TODAY_JOURNAL ]]
+then
+ JLINE="- $(date +'%H:%M'): $1"
+ echo "$JLINE" >> "$TODAY_JOURNAL"
+else
+ touch "$TODAY_JOURNAL"
+ header_date="$(date +'%A %d %b %Y')"
+ { echo -e "# $header_date\n"
+ } >> "$TODAY_JOURNAL"
+ JLINE="- $(date +'%H:%M'): $1"
+ echo "$JLINE" >> "$TODAY_JOURNAL"
+fi