From a0f6877ad437ab9bf8f9ddaee65888470b678382 Mon Sep 17 00:00:00 2001 From: Guilherme Rambo Date: Mon, 29 May 2023 13:36:56 -0300 Subject: [PATCH] Listing development team IDs in bootstrap script --- teamid.sh | 41 +++++++++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/teamid.sh b/teamid.sh index ce91495c..a66db9f1 100755 --- a/teamid.sh +++ b/teamid.sh @@ -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