#!/usr/bin/env bash

set -eo pipefail

TEMPLATES_DIR="$HOME/templates"

while [[ ! -a "$TEMPLATES_DIR/$TEMPLATE/cookiecutter.json" ]]
do
    TEMPLATE="$TEMPLATE/$(ls "$TEMPLATES_DIR/$TEMPLATE" | fzf)"
done

cookiecutter "$TEMPLATES_DIR/$TEMPLATE"
