#!/usr/bin/env bash

brt_serve() {
  local port="${1:-8080}"
  local dir="${2:-.}"
  brt_require python3

  if [[ ! -d "$dir" ]]; then
    brt_error "Directory not found: ${dir}"
    exit 1
  fi

  brt_info "Serving ${dir} on http://0.0.0.0:${port}"
  brt_info "Press Ctrl+C to stop"
  python3 -m http.server "$port" --directory "$dir" --bind 0.0.0.0
}
