forked from GitJournal/GitJournal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflutter_run.sh
executable file
·35 lines (27 loc) · 958 Bytes
/
flutter_run.sh
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
#!/usr/bin/env zsh
# SPDX-FileCopyrightText: 2019-2021 Vishesh Handa <[email protected]>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
set -eu
cd "$(dirname "$0")"
cd ..
FILTER="$1"
DEVICE=$(./flutterw devices --device-timeout=1 --machine | jq -r '.[].name' | fzf -1 -q "$FILTER")
DEVICE_INFO=$(./flutterw devices --machine | jq -r ".[] | select(.name==\"$DEVICE\")")
DEVICE_ID=$(echo "$DEVICE_INFO" | jq -r .id)
DEVICE_TARGET=$(echo "$DEVICE_INFO" | jq -r .targetPlatform)
#echo "Device: $DEVICE"
#echo "Device ID: $DEVICE_ID"
#echo "Device Target: $DEVICE_TARGET"
#print -s "make run \"$DEVICE\""
if [[ $DEVICE_TARGET == *"android"* ]]; then
echo
echo "flutter run -d $DEVICE_ID --flavor dev --track-widget-creation"
echo
./flutterw run -d "$DEVICE_ID" --flavor dev --track-widget-creation
else
echo
echo "flutter run -d $DEVICE_ID --track-widget-creation"
echo
./flutterw run -d "$DEVICE_ID" --track-widget-creation
fi