#!/bin/bash if [ -z $1 ]; then echo "No exercise slug provided" exit 1 fi tolower() { local result=$(echo $1 | tr '[:upper:]' '[:lower:]') echo "$result" } exercise=$(tolower $1) if [ -n "$(find exercises -name $exercise -type d -maxdepth 1)" ]; then echo "Exercise '$exercise' already exists" exit 1 fi if [ -z "$(find bin -name configlet -type f)" ]; then bin/fetch-configlet fi if [ -z "$(find .. -name "problem-specifications" -type d -maxdepth 1)" ]; then git clone https://github.com/exercism/problem-specifications.git \ ../problem-specifications fi mkdir -p exercises/$exercise/tests bin/configlet generate . --only $exercise cp -r template/* exercises/$exercise echo "Done" echo "---" echo "Navigate to 'exercises/$exercise' to start working on '$exercise'" echo "See the 'Generating Setup' part of contributing to figure out the next steps"