From 61329065110b7ab978a2ccc02ea3dd95dbdaf344 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Thu, 22 Sep 2022 14:48:04 -0500 Subject: Add cleanup and better logging --- shite | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/shite b/shite index 3c90130..74bd9af 100755 --- a/shite +++ b/shite @@ -30,10 +30,10 @@ phtml() { meta() { tmp="/tmp/$file.meta" - echo "$tmp" >>/tmp/shite - trap 'rm /tmp/shite' EXIT INT - test -f "$tmp" || sed -n '//p' >"$tmp" - sed -n "s/^$1:[ \t]*//p" "$tmp" + echo "$tmp" >>/tmp/shite.tmp + test -f "$tmp" || + sed -n '//p' >"$tmp" + sed -n "s/^[ \t]*$1:[ \t]*//p" "$tmp" } title() { @@ -50,7 +50,7 @@ filters() { pages() { for file; do - echo >&2 "$file" + echo >&2 "[build] $file" mkdir -p "$OUT"/"${file%.htm}" filters <"$file" | expand .template.html >"$OUT"/"${file%.htm}"/index.html @@ -59,14 +59,14 @@ pages() { index() { for file; do - echo >&2 "index: $file" + echo >&2 "[index] $file" echo "
  • $(title "$file")
  • " done | expand .index.html >"$OUT"/index.html } feed() { for file; do - echo >&2 "feed: $file" + echo >&2 "[feed] $file" echo "" echo " $(title "$file")" echo " $DOMAIN/${file%.htm}/" @@ -98,7 +98,15 @@ EOF exit ${1:-0} } +cleanup() { + while read f; do + rm "$f" + done