polybar-dwm/common/clang-format.sh
patrick96 72948dbc97 fix(clang): Search for files in right places
Before, because of [ -d "$search" ] || search="$(dirname "$search")",
clang-format.sh would search for files to format in the whole repo
(even in the build directory and the submodules)

This now also looks for source files in the tests folder

I have removed the clang-format from clang-tidy.sh because one may want
to run clang-tidy without reformatting
2018-05-20 16:37:18 -07:00

21 lines
362 B
Bash
Executable File

#!/bin/sh
main() {
if [ $# -lt 1 ]; then
echo "$0 DIR..." 1>&2
exit 1
fi
# Search paths
search="${*:-.}"
echo "$0 in $search"
# shellcheck disable=2086
find $search -regex ".*.[c|h]pp" \
-exec printf "\\033[32;1m** \\033[0mFormatting %s\\n" {} \; \
-exec clang-format -style=file -i {} \;
}
main "$@"