Update zsh notes to use strftime rather than date and rename its extension to .zsh rather than .sh

This commit is contained in:
Tony Blyler 2022-05-09 14:27:36 -04:00
parent 93a1fcebee
commit afe5b5cdaf

View file

@ -43,7 +43,7 @@ notes() {
'commit')
git add .
git commit -m "notes commit $(date)"
git commit -m "notes commit $(strftime '%a %d %b %Y %r %Z')"
;;
'push')
@ -79,13 +79,12 @@ notes() {
(
set -euo pipefail
readonly NOW="$(date +%s)"
readonly FILE_PATH="${NOTES_DIR}/$(date -d "@${NOW}" +'%Y/%m/%Y-%m-%d').md"
readonly NOW="$EPOCHSECONDS"
readonly FILE_PATH="${NOTES_DIR}/$(strftime '%Y/%m/%Y-%m-%d.md' "$NOW")"
mkdir -p "$(dirname "${FILE_PATH}")"
if ! [ -e "${FILE_PATH}" ]; then
echo -e "# $(date -d "@${NOW}" +'%a %d %b %Y')\n\n## todo\n\n" > "${FILE_PATH}"
echo -e "# $(strftime '%a %d %b %Y' "$NOW")\n\n## todo\n\n" > "${FILE_PATH}"
fi
"${EDITOR}" "${EDITOR_OPTIONS[@]}" "${FILE_PATH}"