Update zsh notes to use strftime rather than date and rename its extension to .zsh rather than .sh
This commit is contained in:
parent
93a1fcebee
commit
afe5b5cdaf
1 changed files with 4 additions and 5 deletions
|
@ -43,7 +43,7 @@ notes() {
|
||||||
|
|
||||||
'commit')
|
'commit')
|
||||||
git add .
|
git add .
|
||||||
git commit -m "notes commit $(date)"
|
git commit -m "notes commit $(strftime '%a %d %b %Y %r %Z')"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
'push')
|
'push')
|
||||||
|
@ -79,13 +79,12 @@ notes() {
|
||||||
(
|
(
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
readonly NOW="$(date +%s)"
|
readonly NOW="$EPOCHSECONDS"
|
||||||
|
readonly FILE_PATH="${NOTES_DIR}/$(strftime '%Y/%m/%Y-%m-%d.md' "$NOW")"
|
||||||
readonly FILE_PATH="${NOTES_DIR}/$(date -d "@${NOW}" +'%Y/%m/%Y-%m-%d').md"
|
|
||||||
|
|
||||||
mkdir -p "$(dirname "${FILE_PATH}")"
|
mkdir -p "$(dirname "${FILE_PATH}")"
|
||||||
if ! [ -e "${FILE_PATH}" ]; then
|
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
|
fi
|
||||||
|
|
||||||
"${EDITOR}" "${EDITOR_OPTIONS[@]}" "${FILE_PATH}"
|
"${EDITOR}" "${EDITOR_OPTIONS[@]}" "${FILE_PATH}"
|
Loading…
Reference in a new issue