-
Notifications
You must be signed in to change notification settings - Fork 1
/
iOSSimulatorStarter.command
executable file
·54 lines (45 loc) · 1.1 KB
/
iOSSimulatorStarter.command
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
echo ""
echo ""
createmenu ()
{
arr="${@:2}"
arrsize=$1
#echo "Size of array: $arrsize"
#echo $arr
STR=$'\nPlease enter your choice: '
PS3="$STR"
echo "List of available iOS simulators is:"
select option in $arr; do
echo ""
if [ "$REPLY" -eq "$arrsize" ];
then
echo "Exiting..."
break;
elif [ 1 -le "$REPLY" ] && [ "$REPLY" -le $((arrsize-1)) ];
then
#echo "You selected $option which is option $REPLY"
CODE=${option#*[}
CODE=${CODE%]*}
echo "$option started"
/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator -CurrentDeviceUDID $CODE
break;
else
echo "Incorrect Input: Select a number 1-$arrsize"
fi
done
}
arr=()
while IFS= read -r line; do
arr+=( "$line" )
done < <( instruments -s devices )
options=()
for opt in "${arr[@]}"
do
:
VAL=${opt// /_}
options+=( $VAL )
done
options=("${options[@]:1}")
options+=( "Exit" )
createmenu "${#options[@]}" "${options[@]}"