Skip to content

Instantly share code, notes, and snippets.

@Calinou
Created March 3, 2020 14:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Calinou/f6340f04ad00490c30a60b227e486051 to your computer and use it in GitHub Desktop.
Save Calinou/f6340f04ad00490c30a60b227e486051 to your computer and use it in GitHub Desktop.
Portable shell script to format all files in a folder recursively using clang-format
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
find . \( -name '*.cpp' -o -name '*.hpp' -o -name '*.c' -o -name '*.h' \) \
-exec clang-format -i {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment