2016-11-25 10:49:37 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
main() {
|
|
|
|
if [ $# -lt 1 ]; then
|
2017-01-27 03:15:14 +00:00
|
|
|
printf "%s DIR...\n" "$0" 1>&2
|
2016-11-25 10:49:37 +00:00
|
|
|
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 "$@"
|