@echo off
:: File generated by pre-commit: https://pre-commit.com
:: ID: 138fd403232d2ddd5efb44317e38bf03
:: Modified to use relative paths instead of hardcoded paths for Windows

echo ✓ Pre-commit hook is running...

echo ✓ Pre-commit钩子正在运行...

:: Try to detect Python from common virtual environments
set "venv_paths=.\venv\Scripts\python.exe .\venv\Scripts\python3.exe ..\venv\Scripts\python.exe ..\venv\Scripts\python3.exe ..\..\venv\Scripts\python.exe ..\..\venv\Scripts\python3.exe"
set "args=hook-impl --config=.wl\.pre-commit-config.yaml --hook-type=pre-commit"

:: Get the directory where this script is located
set "HERE=%~dp0"
set "args=%args% --hook-dir %HERE% -- %*"

:: Try to find the Python executable in virtual environments
for %%p in (%venv_paths%) do (
    if exist "%%p" (
        "%%p" -mpre_commit %args%
        exit /b
    )
)

:: If no virtual environment Python found, try system pre-commit
where pre-commit >nul 2>nul
if %errorlevel% equ 0 (
    pre-commit %args% 2>&1
    exit /b
)

:: If all fails, show error message
echo `pre-commit` not found.  Did you forget to activate your virtualenv? 1>&2
exit /b 1
