zaphire/Monocle-Engine — pull request #108 by etinquis (2011-12-19 01:25:12+00:00)
Title: AStyle usage for consistent code style

AStyle info can be found at http://astyle.sourceforge.net/.

A sample of the changes it makes can be found at https://gist.github.com/1495012.

You can use the included pre-commit git hook in Tools/githooks/pre-commit by copying it into `%MONOCLEDIR%/.git/hooks/`, which will automatically format the files you attempt to commit, you can format every .cpp/.h file in the tree by using `Tools/AStyle/AStyle -r *.cpp *.h --options=Tools/AStyle/astylerc`, or you can do what the githook does and do something similar to the following in windows:

@echo off
FOR /F %%F IN ('git diff-index --diff-filter=ACMR --cached --name-only HEAD') DO (
echo %%F | findstr /i .cpp > nul 2>&1
if NOT ERRORLEVEL 1 (
Tools/AStyle/AStyle %%F --options=Tools\AStyle\astylerc
)
echo %%F | findstr /i .h > nul 2>&1
if NOT ERRORLEVEL 1 (
Tools/AStyle/AStyle %%F --options=Tools\AStyle\astylerc
)
)

Needs to be tested on linux and mac.