Files
Lyrebird/scripts/uninstall-xcode-templates.sh
2026-06-01 18:27:40 -07:00

42 lines
995 B
Bash
Executable File

#!/usr/bin/env bash
# Remove Lyrebird Xcode file templates from the user template dir.
#
# Deletes
# ~/Library/Developer/Xcode/Templates/File Templates/Lyrebird/
#
# Run from repo root (or anywhere — script uses absolute home path):
# bash scripts/uninstall-xcode-templates.sh
# bash scripts/uninstall-xcode-templates.sh --dry-run
set -euo pipefail
DRY_RUN=false
case "${1:-}" in
--dry-run|-n) DRY_RUN=true ;;
"") ;;
*) echo "usage: $0 [--dry-run]" >&2; exit 2 ;;
esac
DEST="$HOME/Library/Developer/Xcode/Templates/File Templates/Lyrebird"
if [[ ! -d "$DEST" ]]; then
echo "Nothing to remove. Templates not installed at:"
echo " $DEST"
exit 0
fi
COUNT=$(find "$DEST" -maxdepth 1 -type d -name "*.xctemplate" 2>/dev/null | wc -l | tr -d ' ')
echo "Removing Lyrebird template dir ($COUNT templates):"
echo " $DEST"
if [[ "$DRY_RUN" == "true" ]]; then
echo
echo "(dry-run — no changes made)"
exit 0
fi
rm -rf "$DEST"
echo
echo "✓ Removed."