git-cl.cmd 634 B

1234567891011121314151617181920212223
  1. REM Copyright The OpenTelemetry Authors
  2. REM SPDX-License-Identifier: Apache-2.0
  3. @echo off
  4. setlocal enabledelayedexpansion
  5. if "%1" == "format" (
  6. if NOT "%2" == "" (
  7. where clang-format > NUL
  8. if %ERRORLEVEL% neq 0 (
  9. echo clang-format.exe not found in PATH!
  10. echo Assuming default path for LLVM tools...
  11. set PATH="C:\Program Files\LLVM\bin;!PATH!"
  12. )
  13. REM Assume if file exists - it's a full path, else - it's a path relative to git root.
  14. if exist %2 (
  15. set "FILEPATH=%2"
  16. ) else (
  17. set "FILEPATH=%GIT_PREFIX%%2"
  18. )
  19. clang-format -style=file -i --verbose !FILEPATH!
  20. )
  21. )
  22. endlocal