#!/usr/bin/env zsh

# Download the given version of all the templates which exist

VERSION="v10.0.1"
TEMPLATES_DIR=templates-$VERSION

if [ -d $TEMPLATES_DIR ]; then
	rm -rf $TEMPLATES_DIR
fi

for i in custom/templates/**/*.tmpl; do
	newfile=$TEMPLATES_DIR${i#custom/templates}
	echo Downloading $newfile
	mkdir -p $(dirname $newfile)
	curl -o $newfile "https://codeberg.org/forgejo/forgejo/raw/tag/$VERSION/${i#custom/}"
done