mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-30 03:19:11 +08:00
Add a helper script to choose the device and run flutter on it
It makes the entire process so much easier when you have multiple adb devices.
This commit is contained in:
17
scripts/flutter_run.sh
Executable file
17
scripts/flutter_run.sh
Executable file
@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eu
|
||||
|
||||
DEVICES=$(adb devices -l | tail -n +2)
|
||||
NUM_DEVICES=$(echo "$DEVICES" | wc -l)
|
||||
|
||||
if [ "$NUM_DEVICES" = 1 ]; then
|
||||
DEVICE_ID="$DEVICES"
|
||||
else
|
||||
DEVICE_ID=$(echo "$DEVICES" | fzf)
|
||||
fi
|
||||
|
||||
DEVICE_ID=$(echo "$DEVICE_ID" | awk '{ print $1 }')
|
||||
|
||||
echo "Running on $DEVICE_ID"
|
||||
flutter run -d "$DEVICE_ID" --pid-file /tmp/flutter.pid --observatory-port 8888 "$@"
|
Reference in New Issue
Block a user