#!/bin/sh
# milo: Milo from the command line (hci/milo.py). mac/build.sh copies this into Milo.app/Contents/Resources/bin, next to
# the app's own copy of Milo, so the app and the command always run the same code; `milo install` links it onto the PATH.
# In a checkout it runs the checkout. Uses the Mac's own Python, like the app.
self=$0
while [ -L "$self" ]; do  # follow the link `milo install` made, back into the app
  to=$(readlink "$self")
  case $to in /*) self=$to ;; *) self=$(dirname "$self")/$to ;; esac
done
here=$(cd "$(dirname "$self")" && pwd)
if [ -d "$here/../hci-src/hci" ]; then root="$here/../hci-src"; else root="$here/.."; fi
MILO_LAUNCHER="$here/milo" PYTHONPATH="$root${PYTHONPATH:+:$PYTHONPATH}" exec /usr/bin/python3 -m hci.milo "$@"
