summaryrefslogtreecommitdiff
path: root/.scripts.d/10-check.sh
diff options
context:
space:
mode:
authorChristian Segundo2024-07-25 02:12:22 +0200
committerChristian Segundo2024-07-28 12:58:19 +0200
commit15e3dedcee1d0830871ffc692143318a87646101 (patch)
tree3e15f8a3f5082b7df89d208a4c8189b8ad453998 /.scripts.d/10-check.sh
parenta248abee10bbcda6282982d72788acf689deb7aa (diff)
downloadcheck-caps-lock-15e3dedcee1d0830871ffc692143318a87646101.tar.gz
wip
Diffstat (limited to '.scripts.d/10-check.sh')
-rw-r--r--.scripts.d/10-check.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/.scripts.d/10-check.sh b/.scripts.d/10-check.sh
new file mode 100644
index 0000000..a7c3b51
--- /dev/null
+++ b/.scripts.d/10-check.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+# vim: ai:ts=8:sw=8:noet
+set -EeufCo pipefail
+export SHELLOPTS # propagate set to children by default
+IFS=$'\t\n'
+
+# check required commands are in place
+command -v docker >/dev/null 2>&1 || {
+ echo 'please install docker-client'
+ exit 1
+}
+
+docker run --rm \
+ -v "$(pwd)":/site \
+ -w /site \
+ nixos/nix:2.21.4 \
+ bash -c '\
+ nix develop --extra-experimental-features "nix-command flakes" \
+ -c bash -c "prettier --prose-wrap=always -c content/**/*.md"
+ '
+
+echo "Ensure all posts are named with the date prefix" >&2
+find content/posts -type f -name "*.md" | while read -r f; do
+ if [[ ! "$f" =~ ^content/posts/[0-9]{4}-[0-9]{2}-[0-9]{2}-.*\.md$ ]]; then
+ echo "Filename $f does not match date pattern"
+ exit 1
+ fi
+done