summaryrefslogtreecommitdiff
path: root/z-edit-daily
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2022-03-14 22:05:22 -0400
committerBen Sima <ben@bsima.me>2022-03-14 22:05:22 -0400
commit8f32ad9e8828d3daaecac2ce46a45d277bfa8633 (patch)
tree7e8e432e25f5e234ecb56694023b78700195b74f /z-edit-daily
parent71065cfad2345bf143fe99d8fc1fccce939af68f (diff)
z: add daily edit and title search
Diffstat (limited to 'z-edit-daily')
-rwxr-xr-xz-edit-daily12
1 files changed, 12 insertions, 0 deletions
diff --git a/z-edit-daily b/z-edit-daily
new file mode 100755
index 0000000..05da963
--- /dev/null
+++ b/z-edit-daily
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+#
+# Return today's daily notes file. If it doesn't already exist, make it using the
+# daily template. Must be executed from inside the notes directory.
+#
+DATEFMT="+%Y.%-m.%-d"
+DATE=$(date $DATEFMT)
+FILE="daily/$DATE"
+if [[ ! -f "$FILE" ]]; then
+ cat templates/daily.md | sed "s/{{date:YYYY.M.D}}/$DATE/" > $FILE
+fi
+echo "$FILE"