#!/bin/sh set -eu PROJECT_UC= while getopts 'n:N:m:o:l:' flag; do case "$flag" in n) PROJECT="$OPTARG" ;; N) PROJECT_UC="$OPTARG" ;; m) MAILING_LIST="$OPTARG" ;; o) OUTDIR="$OPTARG" ;; l) LANGS="$OPTARG" ;; *) exit 2 ;; esac done shift $((OPTIND - 1)) assert_arg() { if [ -z "$1" ]; then echo "Missing $2" >&2 exit 2 fi } assert_arg "${PROJECT:-}" '-n PROJECT' assert_arg "${MAILING_LIST:-}" '-m MAILING_LIST' assert_arg "${OUTDIR:-}" '-o OUTDIR' assert_arg "${LANGS:-}" '-l LANGS' PROJECT_UC="${PROJECT_UC:-$PROJECT}" mkdir -p "$OUTDIR" sh aux/workflow/TODOs.sh -N "$PROJECT_UC" -n "$PROJECT" -m "$MAILING_LIST" -o "$OUTDIR" for lang in $LANGS; do mkdir -p "$OUTDIR/$lang/" sh aux/workflow/commonmark.sh -N "$PROJECT" -t README -l "$lang" < "README.$lang.md" > "$OUTDIR/$lang/index.html" sh aux/workflow/commonmark.sh -N "$PROJECT" -t CHANGELOG -l "$lang" < "CHANGELOG.$lang.md" > "$OUTDIR/$lang/CHANGELOG.html" cp aux/workflow/favicon.svg aux/workflow/favicon.png "$OUTDIR/$lang" done ln -fs en/index.html "$OUTDIR/index.html" ln -fs en/CHANGELOG.html "$OUTDIR/CHANGELOG.html" cp aux/workflow/favicon.svg aux/workflow/favicon.png "$OUTDIR" sh aux/ci/report.sh -n "$PROJECT" -o "$OUTDIR"