|
|
@ -4,7 +4,7 @@
|
|
|
|
# https://mademistakes.com/notes/adding-last-modified-timestamps-with-git/
|
|
|
|
# https://mademistakes.com/notes/adding-last-modified-timestamps-with-git/
|
|
|
|
# enhanced the script to either update the YAML or TOML frontmatter (as i used both O_o)
|
|
|
|
# enhanced the script to either update the YAML or TOML frontmatter (as i used both O_o)
|
|
|
|
|
|
|
|
|
|
|
|
git diff --cached --name-status | egrep -i "^(A|M).*\.(md)$" | while read a b; do
|
|
|
|
git diff --cached --name-status | grep -E -i "^(A|M).*\.(md)$" | while read a b; do
|
|
|
|
# YAML or TOML frontmatter?
|
|
|
|
# YAML or TOML frontmatter?
|
|
|
|
(grep -E "^---$" $b > /dev/null) && (cat $b | sed "/---.*/,/---.*/s/^lastmod:.*$/lastmod: $(date -u "+%Y-%m-%dT%H:%M:%S%z")/" > tmp)
|
|
|
|
(grep -E "^---$" $b > /dev/null) && (cat $b | sed "/---.*/,/---.*/s/^lastmod:.*$/lastmod: $(date -u "+%Y-%m-%dT%H:%M:%S%z")/" > tmp)
|
|
|
|
(grep -E "^\+\+\+$" $b > /dev/null) && (cat $b | sed "/+++.*/,/+++.*/s/^lastmod.*$/lastmod = '$(date -u "+%Y-%m-%dT%H:%M:%S%z")'/" > tmp)
|
|
|
|
(grep -E "^\+\+\+$" $b > /dev/null) && (cat $b | sed "/+++.*/,/+++.*/s/^lastmod.*$/lastmod = '$(date -u "+%Y-%m-%dT%H:%M:%S%z")'/" > tmp)
|
|
|
|