How to call clang-format over a cpp project folder?

后端 未结 9 2379
眼角桃花
眼角桃花 2021-01-29 21:43

Is there a way to call something like clang-format --style=Webkit for an entire cpp project folder, rather than running it separately for each file?

I am us

9条回答
  •  不知归路
    2021-01-29 21:51

    I recently found a bash-script which does exactly what you need:

    https://github.com/eklitzke/clang-format-all

    This is a bash script that will run clang-format -i on your code.

    Features:

    • Finds the right path to clang-format on Ubuntu/Debian, which encode the LLVM version in the clang-format filename
    • Fixes files recursively
    • Detects the most common file extensions used by C/C++ projects

    On Windows, I used it successfully in Git Bash and WSL.

提交回复
热议问题