Skip to content

Commit

Permalink
Listing development team IDs in bootstrap script
Browse files Browse the repository at this point in the history
  • Loading branch information
insidegui committed May 29, 2023
1 parent 957a832 commit a0f6877
Showing 1 changed file with 35 additions and 6 deletions.
41 changes: 35 additions & 6 deletions teamid.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,47 @@

TEAM_ID_FILE=WWDC/TeamID.xcconfig

function print_team_ids() {
echo ""
echo "FYI, here are the team IDs found in your Xcode preferences:"
echo ""

XCODEPREFS="$HOME/Library/Preferences/com.apple.dt.Xcode.plist"
TEAM_KEYS=(`/usr/libexec/PlistBuddy -c "Print :IDEProvisioningTeams" "$XCODEPREFS" | perl -lne 'print $1 if /^ (\S*) =/'`)

for KEY in $TEAM_KEYS
do
i=0
while true ; do
NAME=$(/usr/libexec/PlistBuddy -c "Print :IDEProvisioningTeams:$KEY:$i:teamName" "$XCODEPREFS" 2>/dev/null)
TEAMID=$(/usr/libexec/PlistBuddy -c "Print :IDEProvisioningTeams:$KEY:$i:teamID" "$XCODEPREFS" 2>/dev/null)

if [ $? -ne 0 ]; then
break
fi

echo "$TEAMID - $NAME"

i=$(($i + 1))
done
done
}

if [ -z "$1" ]; then
echo "What is your Apple Developer Team ID? (looks like 1A23BDCD)"
print_team_ids
echo ""
echo "> What is your Apple Developer Team ID? (looks like 1A23BDCD)"
read TEAM_ID

if [ -z "$TEAM_ID" ]; then
echo "You must enter a team id"
exit 1
fi
else
TEAM_ID=$1
fi

if [ -z "$TEAM_ID" ]; then
echo "You must enter a team id"
print_team_ids
exit 1
fi

echo "Setting team ID to $TEAM_ID"

echo "// This file was automatically generated, do not edit directly." > $TEAM_ID_FILE
Expand Down

0 comments on commit a0f6877

Please sign in to comment.