#!/bin/bash

set -euo pipefail

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
PROJECT="$(basename "$(dirname "${SCRIPT_DIR}")")"

echo "Cleaning ${PROJECT}..."

# Remove output and build directories
for dir in "output" "build"; do
    if [ -d "${SCRIPT_DIR}/${dir}" ]; then
        echo "Removing ${dir} directory..."
        rm -rf "${SCRIPT_DIR:?}/${dir}"
    fi
done

echo "✓ ${PROJECT} cleaned successfully"