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
First create a .clang-format
file if it doesn't exist:
clang-format -style=WebKit -dump-config > .clang-format
Choose whichever predefined style you like, or edit the resulting .clang-format
file.
clang-format configurator is helpful.
Then run:
find . -regex '.*\.\(cpp\|hpp\|cc\|cxx\)' -exec clang-format -style=file -i {} \;
Other file extensions than cpp
, hpp
, cc
and cxx
can be used in the regular expression, just make sure to separate them with \|
.