summaryrefslogtreecommitdiff
path: root/http/bin
diff options
context:
space:
mode:
authorJoe Carstairs <me@joeac.net>2026-06-15 18:12:46 +0100
committerJoe Carstairs <me@joeac.net>2026-06-15 18:12:46 +0100
commit30944071950025472734721651e08447834201d9 (patch)
tree4eea6e66c7c88fa66bd3cc8ec6342821a1bb8c90 /http/bin
parent00af1b4b56c8e2dafdec0f4662262e27865c7712 (diff)
blog script now takes optional -f FILE_PATTERN arg
Diffstat (limited to 'http/bin')
-rwxr-xr-xhttp/bin/blog14
1 files changed, 10 insertions, 4 deletions
diff --git a/http/bin/blog b/http/bin/blog
index 1c77f5a..36753bd 100755
--- a/http/bin/blog
+++ b/http/bin/blog
@@ -7,7 +7,7 @@ export LAYOUTS="$(realpath share/layouts)"
usage()
{
>&2 cat << USAGE
-usage: blog -i LOG [-p POSTPROCESS_CMD] [-a EXTRACT_ARGS_CMD] [-l LAYOUT] [-t]
+usage: blog -i LOG [-p POSTPROCESS_CMD] [-a EXTRACT_ARGS_CMD] [-l LAYOUT] [-t] [-f FILE_PATTERN]
options:
@@ -15,6 +15,9 @@ options:
If provided, a shell command to extract arguments to the layout from the
source files. The shell will be provided with a variable, POST_TITLE.
+ -f FILE
+ If provided, a pattern for the files to process. Default: *.
+
-i LOG
The name of the source directory under \$BLOGS where log posts live.
@@ -32,17 +35,21 @@ USAGE
}
extract_args_cmd="head -n 0 | echo \"POST_TITLE=\\\"\${POST_TITLE}\\\"\""
+file_pattern="*"
log_name=""
layout="default"
postprocess_cmd="echo"
use_filenames_for_titles=0
-while getopts "a:i:l:p:t" opt
+while getopts "a:f:i:l:p:t" opt
do
case $opt in
a)
extract_args_cmd="$OPTARG"
;;
+ f)
+ file_pattern="$OPTARG"
+ ;;
i)
log_name="$OPTARG"
;;
@@ -83,10 +90,9 @@ then
echo >&2 "Warning: no layout found at $(basename "${LAYOUTS}")/${layout_name}.layout.upphtml"
fi
-rm -rf "${SRC}/${log_name}/"
mkdir -p "${SRC}/${log_name}"
-for entry in $(find -L "${BLOGS}/${log_name}" -type f)
+for entry in $(find -L "${BLOGS}/${log_name}" -type f -name "${file_pattern}")
do
basename="$(basename "$entry")"
name="${basename%%\.*}"