bam/docs/watch.sh
Upstream Snapshot 8be13016bc Import upstream snapshot 57d13ead53206a6bf0db3d66f86506ae8c2ce01a
Upstream: https://github.com/pollen-robotics/bam
Upstream-Commit: 57d13ead53206a6bf0db3d66f86506ae8c2ce01a
Upstream-Branch: mjlab_frictionloss
2026-08-28 15:42:08 +08:00

29 lines
705 B
Bash

#!/bin/bash
set -euo pipefail
cd "$(dirname "$0")"
if ! command -v inotifywait >/dev/null 2>&1; then
echo "inotifywait not found. Install inotify-tools (e.g. sudo apt install inotify-tools)."
exit 1
fi
if [[ ! -x ../.venv/bin/sphinx-build ]] && ! command -v sphinx-build >/dev/null 2>&1; then
echo "sphinx-build not found. Run: uv venv ../.venv && uv pip install --python ../.venv/bin/python -r requirements.txt"
exit 1
fi
make html
echo "Starting watching..."
pkill -f "python3 -m http.server 8080" >/dev/null 2>&1 || true
cd _build/html
python3 -m http.server 8080 --bind 127.0.0.1 &
cd ../..
while true
do
inotifywait *.rst */*.rst --recursive
make html
sleep 0.5
done