diff options
author | Luiz Irber <luiz.irber@gmail.com> | 2008-08-09 19:11:23 (GMT) |
---|---|---|
committer | Luiz Irber <luiz.irber@gmail.com> | 2008-08-09 19:11:23 (GMT) |
commit | 2fd568f66ea9d2323175400d70b6f69399e8e1be (patch) | |
tree | 8d2ddb15ad7986031e6ace7cb94e7bd766db4355 | |
parent | 52346854caa1f09963106ac4fd69335e599a6eed (diff) |
-rw-r--r-- | gambiarra.py | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/gambiarra.py b/gambiarra.py index 4d420a3..f1e68ec 100644 --- a/gambiarra.py +++ b/gambiarra.py @@ -22,6 +22,7 @@ import sys import os.path +from optparse import OptionParser # add the libs subdir to the path basedir = os.path.abspath(os.curdir) @@ -32,9 +33,22 @@ if not libdir in sys.path: from Gambiarra.gambiarra import Game -def main(): - game = Game() +def main(play_sounds): + game = Game(play_sounds) game.run() if __name__ == "__main__": - main() + parser = OptionParser() + parser.add_option('-p', '--profile', action='store_true', + dest='profile', default=False, + help='run in profiling mode [default: %default]') + parser.add_option('-s', '--no-sound', action='store_true', + dest='sound', default=False, + help='disable sounds [default: %default]') + options, args = parser.parse_args() + + if options.profile: + import cProfile + cProfile.run('main()', filename='gambiarra.cprof') + else: + main(options.sound) |