31 lines
572 B
Batchfile
31 lines
572 B
Batchfile
@echo off
|
|
REM Variable that will hold the name of the clang-format command
|
|
SET FMT=clang-format
|
|
|
|
REM Function to format files
|
|
:format
|
|
for /r %%f in (*.h *.m *.mm *.c *.cpp) do (
|
|
echo %%~nxf | findstr /i "_generated.h$" >nul
|
|
if errorlevel 1 (
|
|
echo format %%f
|
|
%FMT% -i "%%f"
|
|
)
|
|
)
|
|
echo ~~~ %1 Done ~~~
|
|
exit /b
|
|
|
|
REM Check if argument is provided
|
|
if "%1"=="" (
|
|
echo Please provide a directory as an argument.
|
|
exit /b
|
|
)
|
|
|
|
REM Check if directory exists
|
|
if not exist "%1" (
|
|
echo %1 is not a valid directory.
|
|
exit /b
|
|
)
|
|
|
|
cd %1
|
|
call :format
|