knazarov.com/toc.sh

25 lines
293 B
Bash
Executable file

#!/bin/bash
render() {
TITLE="$1"
DIR="$2"
find "$DIR/" -type f -name '*.md' | while read -r FN
do
echo "FILE: $(realpath $FN)"
done
}
if [ -z "$1" ]; then
echo "Missing page title"
exit 1
fi
if [ ! -d "$2" ]; then
echo "Missing source directory"
exit 1
fi
render "$1" "$2"