#!/bin/sh


if [ -z "$1" ] ; then
        _name=${PWD##*/}
        if [ -z "$_name" ] ; then
                echo "Error - could not determine theme name"
                echo "Please rerun and pass theme name as an argument."
                exit 1
        fi
else
        _name="$1"
fi

# search and replace

find . -type f -name "*.php" -print0 | xargs -0 sed -i '' -e 's/understrap/'"$_name"'_/g'

echo
echo "---------------------------------"
echo "Don't forget to edit `style.css`!"
echo "---------------------------------"
