I would like to run clang-format on a large codebase. I noticed that you
can use wildcards to specify input files to clang-format, however these
wildcards seem to only pick up files in the current directory and not
subdirectories. Is there a way to specify a recursive search with a
wildcard (similar to Artistic Style's --recursive option:
http://astyle.sourceforge.net/astyle.html#_recursive)? Perhaps using a
special wildcard syntax I'm not aware of?
If this isn't currently a feature, what's the likelihood it could make
it in the upcoming release? I have found Artistic Style's --recursive
and --exclude options quite powerful and useful and would love to see
similar functionality in clang-format.
I think that this is basic shell functionality which should not be replicated in each tool. E.g. in most linux shells, just do:
find | xargs clang-format -i
> I think that this is basic shell functionality which should not be
> replicated in each tool. E.g. in most linux shells, just do:
> find | xargs clang-format -i
Some legacy OSes (e.g. Windows) have less capable shells
then the solution is to use more capable shells, more capable OSes or both.
Even with those less capable shells, it should be possible to write a .bat
file that traverses a hierarchy and call commands on files.
Not that I would know how to do it, but the google, harnessing the power of
the intertubes, tells me:
for /r %%f in (*) do echo %%f
Ok, I can certainly wrap it in a find call. I just thought my use case would be fairly common (I’ve come across some other posts online trying to do something similar) and that, being a common use case, it may make sense to support it well from within the tool itself rather than requiring the user to come up with a solution of their own.