commit 84bb74d79f0bf215ebb7bb3042e7268fdf754893
parent f31c0b520f6bb46aec185ad228ac373bf1820648
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Wed, 24 Sep 2025 12:33:15 +0200
Improve reporting of sty-list errors
Diffstat:
1 file changed, 24 insertions(+), 6 deletions(-)
diff --git a/src/sty-list b/src/sty-list
@@ -19,14 +19,14 @@
set -e
-if [ "$#" -lt 1 ]; then
- >&2 printf 'usage: %s <html|shtml|hook|shell|subdir>\n' "${0##*/}"
- exit 1
-fi
-
########################################################################
# Helper functions
########################################################################
+usage()
+{
+ >&2 printf 'usage: %s resource\n' "${0##*/}"
+}
+
# List of HTML files to generate from Markdown files or shell scripts
# stored in each section
html()
@@ -113,10 +113,28 @@ subdir()
########################################################################
# Script
########################################################################
+if [ "$#" -lt 1 ]; then
+ usage
+ exit 1
+fi
+
+if [ ! -e menu.tsv ]; then
+ >&2 printf '%s: this is not a star-typesetting root directory: ' "${0##*/}"
+ >&2 printf 'the menu.tsv file is missing.\n'
+ exit 1
+fi
+
# List of sections to be dealt with
sections="$(sections)"
[ -z "${sections}" ] && exit 0 # No section
search_dirs="$(printf '%s\n' "${sections}" | tr '\n' ' ')"
-"$@"
+case "$1" in
+ "html") html ;;
+ "hook") hook ;;
+ "shell") shell ;;
+ "shtml") shtml ;;
+ "subdir") subdir ;;
+ *) usage; exit 1 ;;
+esac