add journaling function

This commit is contained in:
sigil-03 2025-05-14 21:28:28 -06:00
commit be8b1d3e6b
2 changed files with 23 additions and 0 deletions

6
README.md Normal file
View file

@ -0,0 +1,6 @@
# NOTE
functions that i use for taking notes
## `journal()`
use to enter a timestamped text entry to a file with the current date. will create the file if it does not exist.

17
journal.shf Normal file
View file

@ -0,0 +1,17 @@
# ENV REQUIREMENTS:
# - JOURNALDIR: default journal directory
function journal() {
if [ ! -d "${JOURNALDIR}" ]; then
mkdir -p "${JOURNALDIR}"
fi
FILE="${JOURNALDIR}$(date '+%Y-%m-%d')"
echo "${FILE}"
if [ ! -f $FILE ]; then
echo "$(date '+%Y-%m-%d')\n" >> $FILE
else
echo "\n" >> $FILE
fi
echo ">> $(date '+%H:%M:%S')" >> $FILE
vim +$ ${FILE}
}