:: 配置参数 set MYPATH=%cd% set VERBOSE=0 :: 0=简洁模式, 1=详细模式 set EXCLUDE_DIRS=pass :: 要排除的目录名
:: 颜色定义 for /f "delims=#" %%a in ('"prompt #$E# & for %%b in (1) do rem"') doset"ESC=%%a" set"COLOR_RED=%ESC%[91m" set"COLOR_GREEN=%ESC%[92m" set"COLOR_YELLOW=%ESC%[93m" set"COLOR_RESET=%ESC%[0m"
:: 主函数 call :main pause exit /b
:main for /d %%a in ("%MYPATH%\*") do ( echo %%a|findstr /i "%EXCLUDE_DIRS%" >nul if !errorlevel! neq 0 ( call :process_repo "%%a" ) ) exit /b
:process_repo set"repo_path=%~1" pushd"!repo_path!" if exist .git ( call :get_git_info call :check_repo_status call :update_repo ) else ( for /d %%b in ("!repo_path!\*") do ( echo %%b|findstr /i "%EXCLUDE_DIRS%" >nul if !errorlevel! neq 0 ( call :process_repo "%%b" ) ) ) popd exit /b
:get_git_info for /f "delims=" %%b in ('git rev-parse --abbrev-ref HEAD 2^>nul') doset"branch=%%b" for /f "delims=" %%c in ('git config --get remote.origin.url 2^>nul') doset"remote_url=%%c" exit /b