From afe5b5cdaf399d5a1fa584c6d4f41ff1df2f0e5f Mon Sep 17 00:00:00 2001 From: Tony Blyler Date: Mon, 9 May 2022 14:27:36 -0400 Subject: [PATCH] Update zsh notes to use strftime rather than date and rename its extension to .zsh rather than .sh --- .../{executable_notes.sh => executable_notes.zsh} | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) rename chezmoi/dot_zshrc.d/{executable_notes.sh => executable_notes.zsh} (82%) diff --git a/chezmoi/dot_zshrc.d/executable_notes.sh b/chezmoi/dot_zshrc.d/executable_notes.zsh similarity index 82% rename from chezmoi/dot_zshrc.d/executable_notes.sh rename to chezmoi/dot_zshrc.d/executable_notes.zsh index f3fde76..e4be69a 100644 --- a/chezmoi/dot_zshrc.d/executable_notes.sh +++ b/chezmoi/dot_zshrc.d/executable_notes.zsh @@ -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}"