commit 7a458f6eb082744df2b282ca79ba4c78571df6ef (patch)
parent dc6ae98c5e7bb2510ef81ce4f30fe3a8d57c2bf6
Author: Alex Karle <alex@alexkarle.com>
Date: Sun, 25 Apr 2021 17:29:29 -0400
bin: Move template.7 to newpost script
This is mostly to clean up the kiosk choices to not show the template,
but the script itself is a nice touch too.
Diffstat:
3 files changed, 28 insertions(+), 14 deletions(-)
diff --git a/bin/gengopher.sh b/bin/gengopher.sh
@@ -15,7 +15,7 @@ done
# Remove/move some non-phlog cruft
mv $PHLOG/intro.txt $DEPLOY/intro.txt
-rm $PHLOG/template.txt
+rm -f $PHLOG/template.txt
# Set the mtimes so they show nicely in the directory listing
# by parsing the .Dd lines using grep(1) and date(1)
diff --git a/bin/newpost b/bin/newpost
@@ -0,0 +1,27 @@
+#!/bin/sh
+set -e
+die() {
+ echo "$1" 1>&2
+ exit 1
+}
+
+[ -z "$1" ] && die "usage: $(basename "$0") NAME"
+
+name="$1"
+TITLE=$(printf "$name" | tr [a-z] [A-Z])
+
+cat <<EOM > "$name".7
+.Dd $(date +"%B %d, %Y")
+.Dt $TITLE 7
+.Os
+.Sh NAME
+.Nm $name
+.Nd <desc>
+.Sh DESCRIPTION
+entry
+.Sh SEE ALSO
+.Bl -bullet -compact
+.It
+.Xr blog 7
+.El
+EOM
diff --git a/template.7 b/template.7
@@ -1,13 +0,0 @@
-.Dd January 1, 2021
-.Dt TITLE 7
-.Os
-.Sh NAME
-.Nm <title>
-.Nd <desc>
-.Sh DESCRIPTION
-entry
-.Sh SEE ALSO
-.Bl -bullet -compact
-.It
-.Xr blog 7
-.El