#!/usr/bin/env bash
# Thin wrapper so you can type `scripts/artefacts-route record ...` without installing.
# Expects the ROS environment to be sourced already.
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
if [ -z "${ROS_DISTRO:-}" ]; then
  echo "error: ROS is not sourced. Run:  source /opt/ros/<distro>/setup.bash  (setup.zsh under zsh)" >&2
  exit 2
fi
if [ -x "$ROOT/venv/bin/python" ]; then PY="$ROOT/venv/bin/python"; else PY=/usr/bin/python3; fi
export PYTHONPATH="$ROOT${PYTHONPATH:+:$PYTHONPATH}"
exec "$PY" -m artefacts_route_recorder.cli "$@"
