Skip to content

Instantly share code, notes, and snippets.

@dirtycajunrice
Last active July 23, 2024 19:18
Show Gist options
  • Save dirtycajunrice/16f0131108bd34104821d4fa424d2f2b to your computer and use it in GitHub Desktop.
Save dirtycajunrice/16f0131108bd34104821d4fa424d2f2b to your computer and use it in GitHub Desktop.
Template renamer for UnrealEnginePluginTemplate
#!/usr/bin/env bash
export MODULE_NAME="$(basename $(git rev-parse --show-toplevel))"
if [ -z "${MODULE_NAME}" ]; then
echo "No module name available"
fi
# Replace file names
find . -name '*MyPlugin*' -printf "%d %p\n" | sort -r | cut -d' ' -f2 | xargs -I{} sh -c 'mv -v {} $(echo {} | sed "s/MyPlugin/$MODULE_NAME/g")'
# Replace content
grep "MyPlugin" . -lr | xargs sed -i "s/MyPlugin/$MODULE_NAME/g"
# Wipe readme
echo "# ${MODULE_NAME}" > README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment