Files
exteraGramPlugins a3b0b264c1 Initial commit
2026-09-12 02:03:47 +00:00

50 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")/.."
source scripts/lib.sh
need_cmd "$ADB" "$PY"
usage() {
cat >&2 <<'EOF'
usage: scripts/debug.sh start|stop [--platform vscode|pycharm]
Requires the device-side debugger package to be present in the app's Python
runtime: `debugpy` for vscode, `pydevd-pycharm` for pycharm. If it is not
installed, add it to "requirements" in plugin.json so the app's pip
controller installs it on next load.
EOF
}
[[ $# -ge 1 ]] || { usage; exit 1; }
ACTION="$1"
shift
PLATFORM=vscode
while [[ $# -gt 0 ]]; do
case "$1" in
--platform)
PLATFORM="${2:-}"
shift 2
;;
--platform=*)
PLATFORM="${1#--platform=}"
shift
;;
*)
die "unknown argument: $1"
;;
esac
done
case "$ACTION" in
start|stop) ;;
*) usage; exit 1 ;;
esac
case "$PLATFORM" in
vscode|pycharm) ;;
*) die "--platform must be vscode or pycharm" ;;
esac
scripts/adb-connect.sh --debug
"$PY" tools/devclient.py debugger "$ACTION" --platform "$PLATFORM"