this repo has no description
1#!/bin/bash
2#
3# Reindent CWD recursively using clang-format (assumed to be in your PATH),
4# and per-component or per-directory .clang-format style specifications.
5#
6
7CPUS=`sysctl -n hw.logicalcpu`
8CLANGFORMAT=${CLANGFORMAT:=`xcrun -find clang-format`}
9
10if [ ! -x "${CLANGFORMAT}" ]; then
11 echo "Could not find clang-format" 1>&2
12 exit 1
13fi
14
15echo "Using ${CLANGFORMAT} to reindent, using concurrency of ${CPUS}"
16
17find -x . \! \( \( -name BUILD -o -name EXTERNAL_HEADERS -o -name libMicro -o -name zlib -o -name .svn -o -name .git -o -name cscope.\* -o -name \*~ \) -prune \) -type f \( -name \*.c -o -name \*.cpp \) -print0 | \
18 xargs -0 -P "${CPUS}" -n 10 "${CLANGFORMAT}" -style=file -i
19ret=$?
20
21if [ $ret -ne 0 ]; then
22 echo "reindent failed: $ret" 1>&2
23 exit 1
24fi
25
26exit 0
27