#! /usr/bin/env bash cd "$(dirname "$0")" name="$(basename "$(pwd)")" # Check if we want to run against a certain translation if [ $# -lt 1 ]; then echo "Please specify the language you want to build (eg. fr)" exit 1 fi TARGETLANG="$1" SOURCEFILE="main.${TARGETLANG}.typ" t="$(mktemp --suffix=.pdf)" if ! typst compile --root .. ./"$SOURCEFILE" "$t"; then echo "Failed to compile $name/"$SOURCEFILE". Please fix errors and run me again." exit 1 fi echo "Initial compilation successful. Now starting watch mode. Opening $t" xdg-open "$t" typst watch --root .. ./"$SOURCEFILE" "$t"