FormatSource.sh 527 B

12345678910111213141516171819202122232425
  1. #!/bin/bash
  2. files=(`find ./AnKi ./Tests ./Sandbox ./Tools ./Samples -name '*.h' -o -name '*.hpp' -o -name '*.c' -o -name '*.cpp' -o -name '*.glsl' -o -name '*.glslp' -o -name '*.ankiprog'`)
  3. filecount=${#files[@]}
  4. count=0
  5. for f in ${files[@]}
  6. do
  7. # Run it in parallel
  8. echo -ne Formatting ${count}/${filecount}\\r
  9. ./ThirdParty/Bin/clang-format -sort-includes=false -i ${f} &
  10. count=$((${count}+1))
  11. # Throttle the parallel commands
  12. if !((count % 16)); then
  13. wait
  14. fi
  15. done
  16. wait
  17. echo Done! Formatted ${filecount} files