web/caddyfmt
2# Look for any Caddyfiles in the current directory, and use `caddy fmt`
5# This skips any Caddyfiles that contain `[[[cog`, which is a sign that
6# they use Cog for templates: https://alexwlchan.net/2026/cog-in-my-caddy/
12 caddy fmt
"$1" >/dev/null
2>
&1
13 if (( $? !
= 0 )); then
15 caddy fmt --overwrite
"$1"
19export -f format_caddyfile
21find .
\( -name Caddyfile -o -name
'*.Caddyfile' \) -print0
\
22 | xargs -0 grep -L
'\[\[\[cog' \
23 | xargs -I
'{}' bash -c
'format_caddyfile "$1"' _
{}