Added reformat command to hm.py
This commit is contained in:
parent
7dd6671c13
commit
318980c26c
11
hm.py
11
hm.py
|
@ -51,6 +51,7 @@ commands = [
|
||||||
'revision',
|
'revision',
|
||||||
'help',
|
'help',
|
||||||
'hammer',
|
'hammer',
|
||||||
|
'reformat',
|
||||||
'--help',
|
'--help',
|
||||||
'-h',
|
'-h',
|
||||||
'/?'
|
'/?'
|
||||||
|
@ -130,6 +131,7 @@ def usage():
|
||||||
' package Create a distribution package (e.g. tar.gz)\n'
|
' package Create a distribution package (e.g. tar.gz)\n'
|
||||||
' install Installs the program\n'
|
' install Installs the program\n'
|
||||||
' hammer Golden hammer (config, build, package)\n'
|
' hammer Golden hammer (config, build, package)\n'
|
||||||
|
' reformat Reformat .cpp and .h files using AStyle\n'
|
||||||
' usage Shows the help screen\n'
|
' usage Shows the help screen\n'
|
||||||
'\n'
|
'\n'
|
||||||
'Alias commands:\n'
|
'Alias commands:\n'
|
||||||
|
@ -468,6 +470,8 @@ def main(argv):
|
||||||
setup()
|
setup()
|
||||||
elif cmd in ['hammer']:
|
elif cmd in ['hammer']:
|
||||||
hammer()
|
hammer()
|
||||||
|
elif cmd in ['reformat']:
|
||||||
|
reformat()
|
||||||
else:
|
else:
|
||||||
print 'Command not yet implemented:',cmd
|
print 'Command not yet implemented:',cmd
|
||||||
|
|
||||||
|
@ -756,5 +760,12 @@ def hammer():
|
||||||
for pt in package_types:
|
for pt in package_types:
|
||||||
package(pt)
|
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.
|
# Start the program.
|
||||||
main(sys.argv)
|
main(sys.argv)
|
||||||
|
|
Loading…
Reference in New Issue