#!/usr/bin/env bash
# android_shell — Execute arbitrary shell command on Android device via adb shell

# shellcheck source=./adb_wsl.sh
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/adb_wsl.sh"

android_shell() {
    adb_pick_serial "$@" || exit 3
    local serial="$ADB_PICK_SERIAL"
    set -- "${ADB_PICK_REST[@]}"

    adb_s "$serial" shell "$@"
}

if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
    android_shell "$@"
fi
