#!/bin/env bash
set -eu
set -o pipefail

DIR="$(dirname "${BASH_SOURCE[0]}")"

MODE="${1:-test}";
if (( $# > 1)); then shift; fi

TYPST_ROOT="$(realpath "$DIR/..")"

if ! hash typst; then
  >&2 echo "Could not find 'typst' binary. Run this script with the --install argument to temporarily install typst."
  exit 1
fi

typst compile template/main.typ --root "$TYPST_ROOT" --font-path "$TYPST_ROOT/fonts" 
echo "[  OK]"