polybar-dwm/common/clang-format.sh
2016-11-25 14:17:57 +01:00

20 lines
371 B
Bash
Executable File

#!/bin/sh
main() {
if [ $# -lt 1 ]; then
echo "$0 DIR..." 1>&2
exit 1
fi
search="${*:-.}"
[ -d "$search" ] || search="$(dirname "$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 "$@"