From 318980c26c31dfb5dcd5b752518a2bf7697741c9 Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Sun, 27 Dec 2009 20:12:41 +0000 Subject: [PATCH] Added reformat command to hm.py --- hm.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hm.py b/hm.py index 3277a769..e45ed8eb 100644 --- a/hm.py +++ b/hm.py @@ -51,6 +51,7 @@ commands = [ 'revision', 'help', 'hammer', + 'reformat', '--help', '-h', '/?' @@ -130,6 +131,7 @@ def usage(): ' package Create a distribution package (e.g. tar.gz)\n' ' install Installs the program\n' ' hammer Golden hammer (config, build, package)\n' + ' reformat Reformat .cpp and .h files using AStyle\n' ' usage Shows the help screen\n' '\n' 'Alias commands:\n' @@ -468,6 +470,8 @@ def main(argv): setup() elif cmd in ['hammer']: hammer() + elif cmd in ['reformat']: + reformat() else: print 'Command not yet implemented:',cmd @@ -756,5 +760,12 @@ def hammer(): for pt in package_types: package(pt) +def reformat(): + # TODO: error handling + os.system( + r'tool\astyle\AStyle.exe ' + '--quiet --suffix=none --style=java --indent=force-tab=4 --recursive ' + 'lib/*.cpp lib/*.h cmd/*.cpp cmd/*.h') + # Start the program. main(sys.argv)