Files
GitJournal/scripts/flutter_run.sh
Vishesh Handa 7dc6433538 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.
2019-02-16 11:33:18 +01:00

18 lines
381 B
Bash
Executable File

#!/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 "$@"