facebook/tornado — pull request #421 by mher (2011-12-15 22:18:57+00:00)
Title: Option name can't be dashed

>>> from tornado.options import options, define, parse_command_line
>>> define("mysql-host", default="127.0.0.1")
>>> parse_command_line("progname --mysql-host=localhost".split())
Usage: [OPTIONS]

Options:
--help show this help information
--log_file_max_size max size of log files before rollover
--log_file_num_backups number of log files to keep
--log_file_prefix=PATH Path prefix for log files. Note that if you are running multiple tornado processes, log_file_prefix must be different for each of them (e.g. include the port number)
--log_to_stderr Send log output to stderr (colorized if possible). By default use stderr if --log_file_prefix is not set and no other logging is configured.
--logging=info|warning|error|none Set the Python log level. If 'none', tornado won't touch the logging configuration.

--mysql-host

Traceback (most recent call last):
File "", line 1, in
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tornado/options.py", line 125, in parse_command_line
raise Error('Unrecognized command line option: %r' % name)
tornado.options.Error: Unrecognized command line option: 'mysql_host'

With patch:

>>> from tornado.options import options, define, parse_command_line
>>> define("mysql-host", default="127.0.0.1")
>>> parse_command_line("progname --mysql-host=localhost".split())
[]
>>> options.mysql_host
u'localhost'
>>> options['mysql-host'].value()
u'localhost'