scripts/day

28 lines
591 B
Bash
Executable File

#!/bin/sh
# Based on day script from mischavandenburg
# url: https://github.com/mischavandenburg/dotfiles/blob/main/scripts/day
today=$(date +"%Y-%m-%d")
tomorrow=$(date -d "tomorrow" '+%Y-%m-%d')
yesterday=$(date -d "yesterday" '+%Y-%m-%d')
file="$SECOND_BRAIN"'/periodic/daily/'"$today.md"
cd "$SECOND_BRAIN" || exit 1
new_note() {
cp "$SECOND_BRAIN/templates/daily.md" "$file"
sed -i "s/TODAY/$today/" "$file"
sed -i "s/YESTERDAY/$yesterday/" "$file"
sed -i "s/TOMORROW/$tomorrow/" "$file"
}
if [ ! -f "$file" ]; then
new_note
fi
nvim '+ normal Gzzo' "$file"