#!/usr/bin/env bash
# Batch detect target_path on「未设路径」servers (SSH find workerman.bat).
#
# Usage:
#   bash scripts/batch_detect_target_path.sh --unset-only
#   bash scripts/batch_detect_target_path.sh --unset-only --dry-run
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
SECRETS="${ROOT}/deploy/nexus-1panel.secrets.sh"
if [[ -f "$SECRETS" ]]; then
  # shellcheck disable=SC1090
  source "$SECRETS"
fi
PYTHON="${ROOT}/.venv/bin/python"
[[ -x "$PYTHON" ]] || PYTHON="${ROOT}/venv/bin/python"
[[ -x "$PYTHON" ]] || PYTHON=python3
exec "$PYTHON" "${ROOT}/scripts/batch_detect_target_path.py" "$@"
