summaryrefslogtreecommitdiff
path: root/tools/new-nrl-opmode.sh
blob: 6fb5400d7b522636139af33d1cb4bb4b0b23ee1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env bash
# ===================================================================
#  NRL - Create a New OpMode  (launcher, macOS / Linux)
#  Scaffolds a robot OpMode from a minimal template, then opens it.
#  Usage:  bash tools/new-nrl-opmode.sh    (or chmod +x and run it)
# ===================================================================
set -euo pipefail

here="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
script="$here/nrl_new_opmode.py"

# Find a usable Python 3; if none is found, ensure-python.sh installs one
# automatically and prints its path.
pyexe="$(bash "$here/ensure-python.sh")" || {
    echo "[error] Python 3 was not found and could not be installed automatically." >&2
    echo "        Install Python 3 from https://www.python.org/downloads/ and re-run." >&2
    exit 1
}
exec "$pyexe" "$script" --open "$@"