From c94d3a048c2911c42ead222a9f9990d4c4305cb6 Mon Sep 17 00:00:00 2001 From: IRainman Date: Tue, 6 May 2025 14:32:53 +0300 Subject: [PATCH] clang-format --- format.cmd | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/format.cmd b/format.cmd index 9b9af7f..34d891c 100644 --- a/format.cmd +++ b/format.cmd @@ -1,7 +1,25 @@ @echo off -echo Formatting with config... -for /R ".\" %%f in (*.cpp, *.h, *.c, *.hpp) do ( - echo Formatting "%%f" - clang-format -i -style=file "%%f" +setlocal enabledelayedexpansion + +echo Searching for clang-format... +where clang-format >nul 2>&1 +if %errorlevel% neq 0 ( + echo Error: clang-format not found in PATH. Install LLVM or add it to PATH. + exit /b 1 ) -echo Done! \ No newline at end of file + +echo Checking for .clang-format... +if not exist ".clang-format" ( + echo Error: .clang-format config file not found in the current directory. + exit /b 1 +) + +echo Formatting files with .clang-format... +set count=0 +for /R ".\" %%f in (*.cpp, *.h, *.c, *.hpp) do ( + echo Formatting "%%f" + clang-format -i -style=file "%%f" + set /a count+=1 +) + +echo Done. Proccesed !count! files. \ No newline at end of file