A great uncrustify
utility does not have (afaik) an option to recursively process all the files in the folder/project. Fear not. find(1)
to the rescue!
I am using zsh
(specifically ohmyzsh
) so I’ve put the following alias (it can certainly be done as an alias but I like the better clarity definition of a function provides)
The following will process all the .h
and .m
files except the ones that are in /libs
path and that have .framework
in their name – avoiding the libraries and system frameworks. You may want to add additional exceptions fitting to your usecase and naming conventions.
function uncrusrify-ios {
echo "\nUncrustify all files in current dir except ones in */libs/* folder and names containing *.framework.*\n\n"
find . -name "*.[hm]" ! -path "*/libs/*" ! -path "*.framework*" -print0 | xargs -0 uncrustify -c .uncrustify.cfg --replace --no-backup
echo "\nDONE\n"
}
Enjoy!
and I hope you find this snippet useful