aboutsummaryrefslogblamecommitdiff
path: root/src/development/dynmake.sh
blob: 9c60b88de8222dbf834a28b77fdb38317ed54ffd (plain) (tree)
1
2
3
4
5
6
7





                      
                            


























                                                 
                          
                       














                                 
                                               



                      

 

                                        


                            


                                             
#!/bin/sh
set -eu

usage() {
	cat <<-'EOF'
		Usage:
		  dynmake.sh
		  dynmake.sh -h
	EOF
}

help() {
	cat <<-'EOF'

		Options:
		  -h, --help    show this message
	EOF
}

for flag in "$@"; do
	case "$flag" in
		--)
			break
			;;
		--help)
			usage
			help
			exit
			;;
		*)
			;;
	esac
done

while getopts 'h' flag; do
	case "$flag" in
		h)
			usage
			help
			exit
			;;
		*)
			usage >&2
			exit 2
			;;
	esac
done
shift $((OPTIND - 1))

assert_arg() {
	if [ -z "$1" ]; then
		printf 'Missing %s.\n' "$2" >&2
		exit 2
	fi
}



printf 'pastebins.md = \\\n'
find src/content/pastebin -name '*.md' |
	sed -e 's/^/	/' \
	    -e 's/$/ \\/'
printf '\n'

find src/content/pastebin -name '*.md' |
	sed 's/^\(.*\)\.md$/\1.html: \1.env/'