Created
August 31, 2010 00:55
-
-
Save apathyboy/558331 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
function format_cpp { | |
file="${1}"; | |
echo "${file}" | grep -ie "^.*\.cpp$" > /dev/null | |
if [ "$?" -eq 0 ]; then | |
if [ -f "${file}" ]; then | |
set -e | |
astyle -Q -z1 "${file}" | |
rm -f "${file}.orig" | |
git add "${file}" | |
set +e | |
fi | |
fi | |
} | |
for file in `git diff-index --cached --name-only HEAD`; do | |
format_cpp "${file}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment