Skip to content

Instantly share code, notes, and snippets.

@dive dive/

Created Jul 19, 2020
What would you like to do?
Shell script to scan and open Xcode projects in the current directory
#!/usr/bin/env bash
set -euo pipefail
declare -a PROJECTS=()
function XcodeProjectsInCurrentDirectory() {
find . -iname "$SEARCH_PATTERN" -type d -print0 | sort -z > "$TEMP_FILE"
while IFS= read -r -d $'\0'; do
done <"$TEMP_FILE"
rm -f "$TEMP_FILE"
function ListProjects() {
echo "Collecting .xcodeproj..."
XcodeProjectsInCurrentDirectory "$1"
if [ "${#PROJECTS[@]}" -eq 0 ]; then
echo "The project not found."
exit 0
elif [ "${#PROJECTS[@]}" -eq 1 ]; then
echo "Opening ${PROJECTS[0]}..."
xed "${PROJECTS[0]}"
echo "Please select a project:"
select d in "${PROJECTS[@]}"; do test -n "$d" && break; echo ">>> Invalid Selection"; done
echo "Opening ${d}..."
xed "$d"
ListProjects "${1-}"
unset XcodeProjectsInCurrentDirectory;
unset ListProjects;

This comment has been minimized.

Copy link
Owner Author

dive commented Jul 21, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.