@echo off

:parameters
set SCRIPTS_DIR=%CD%
set DIRECTORIES=..\examples ..\include ..\src
set FILES_TO_UPDATE=*.h *.c *.hpp *.cpp *.hxx *.cxx *.cc *.tcc

:scan
:: for all directories
for %%D in (%DIRECTORIES%) do (
    echo Scanning directory '%%D'
    
    cd %SCRIPTS_DIR%
    cd %%D
    :: find source files
    :: update each file
    for /R %%E in (%FILES_TO_UPDATE%) do (
        echo Formatting file '%%E'
        clang-format -i --style=file %%E
    )
)

:exit
cd %SCRIPTS_DIR%
pause
