From 7452082adf9df08fa231b1ac0aa2048d3e32f72e Mon Sep 17 00:00:00 2001
From: EuAndreh
Date: Wed, 30 Apr 2025 07:42:56 -0300
Subject: src/categoriesbody: Omit listing header
---
src/indexbody | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
(limited to 'src/indexbody')
diff --git a/src/indexbody b/src/indexbody
index eaef320..75d7f1d 100755
--- a/src/indexbody
+++ b/src/indexbody
@@ -3,16 +3,32 @@ set -euo pipefail
usage() {
- echo 'Usage: indexbody FILENAME.conf [SORTDATA]'
+ echo 'Usage: indexbody [-n] FILENAME.conf [SORTDATA]'
}
+
+EMIT_HEADER=true
+while getopts 'n' flag; do
+ case "$flag" in
+ (n)
+ EMIT_HEADER=false
+ ;;
+ (*)
+ usage >&2
+ exit 2
+ ;;
+ esac
+done
+shift $((OPTIND - 1))
+
FILENAME="${1:-}"
SORTDATA="${2:-"$(dirname -- "$FILENAME")"/sortdata.txt}"
eval "$(assert-arg -- "$FILENAME" 'FILENAME.conf')"
. ./"$FILENAME"
-cat <
Atom feed
@@ -20,6 +36,11 @@ cat <categories.
EOF
+}
+
+if [ "$EMIT_HEADER" = true ]; then
+ header
+fi
printf ' \n'
cat -- "$SORTDATA" |
--
cgit v1.2.3