aboutsummaryrefslogtreecommitdiff
path: root/_scripts/postinfo
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-10-16 20:55:00 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2024-10-16 20:55:00 +0200
commit0e106be1dc6d52ce14f1291ac1ec1149007f918c (patch)
tree8ad119b0a0569bf549230eff1de92d6d75b07f75 /_scripts/postinfo
parent9b4fb13f94bc8fa2f7d50519652bead8ede4ee3a (diff)
generate post info using gitjekyll
Diffstat (limited to '_scripts/postinfo')
-rwxr-xr-x_scripts/postinfo21
1 files changed, 21 insertions, 0 deletions
diff --git a/_scripts/postinfo b/_scripts/postinfo
new file mode 100755
index 0000000..95fe872
--- /dev/null
+++ b/_scripts/postinfo
@@ -0,0 +1,21 @@
+#!/bin/sh
+file="$1"
+tab="$(printf '\t')"
+
+history="$(git log \
+ --follow \
+ --ignore-all-space --diff-filter=AM \
+ --date=short --pretty=format:"%cd$tab%an" \
+ -- "$file")"
+
+dates="$(echo "$history" | cut -d"$tab" -f1)"
+authors="$(echo "$history" | cut -d"$tab" -f2 | sort -u)"
+
+cat << EOF
+date: $(echo "$dates" | head -n1)
+date_initial: $(echo "$dates" | tail -n1)
+edits: $(echo "$dates" | wc -l)
+authors:
+$(echo "$authors" | sed 's/^/- /')
+EOF
+