Permalink
Browse files

Adding extensibility to command-line options

  • Loading branch information...
1 parent 376a192 commit 6ed5b0d476b2a10ebfea2c66ca193ff7fda87fbb Jason Baker committed Aug 17, 2010
Showing with 6 additions and 2 deletions.
  1. +6 −2 shrapnel/command.py
View
@@ -20,6 +20,7 @@
class ShrapnelApplication(object):
+ cmd_options = []
def get_tornado_server(self, application):
return tornado.httpserver.HTTPServer(application)
@@ -67,7 +68,10 @@ def run(self):
help = "The path to a file which will contain the server's informational log messages."
)
- options, args = parser.parse_args()
+ for args, kwargs in self.cmd_options:
+ parser.add_option(*args, **kwargs)
+
+ self.options, args = parser.parse_args()
os.chdir(self.path)
# tornado.locale.load_translations(
@@ -76,7 +80,7 @@ def run(self):
signal.signal(signal.SIGINT, self._do_signal)
signal.signal(signal.SIGTERM, self._do_signal)
- self.start(options)
+ self.start(self.options)
def _daemonize(self, options):
# http://code.activestate.com/recipes/278731/

0 comments on commit 6ed5b0d

Please sign in to comment.