myapp.py 722 B

123456789101112131415161718192021222324252627282930313233343536
  1. from cement.core.foundation import CementApp
  2. from cement.core.controller import CementBaseController
  3. VERSION = '0.9.1'
  4. BANNER = """
  5. My Awesome Application v%s
  6. Copyright (c) 2014 John Doe Enterprises
  7. """ % VERSION
  8. class MyBaseController(CementBaseController):
  9. class Meta:
  10. label = 'base'
  11. description = 'MyApp Does Amazing Things'
  12. arguments = [
  13. (['-v', '--version'], dict(action='version', version=BANNER)),
  14. ]
  15. class MyApp(CementApp):
  16. class Meta:
  17. label = 'myapp'
  18. base_controller = MyBaseController
  19. def main():
  20. app = MyApp()
  21. try:
  22. app.setup()
  23. app.run()
  24. finally:
  25. app.close()
  26. if __name__ == '__main__':
  27. main()