From: Michael V. DePalatis Date: Wed, 27 Dec 2017 02:40:43 +0000 (-0600) Subject: Document that options can be booleans X-Git-Tag: v5.0.0~28^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f8420314729e03e31845582ea9278d16ccf7832e;p=thirdparty%2Ftornado.git Document that options can be booleans Addresses #2222 --- diff --git a/tornado/options.py b/tornado/options.py index 707fbd35e..f126758ea 100644 --- a/tornado/options.py +++ b/tornado/options.py @@ -47,14 +47,15 @@ either:: tornado.options.parse_config_file, the only options that are set are ones that were previously defined with tornado.options.define. -Command line formats are what you would expect (``--myoption=myvalue``). -Config files are just Python files. Global names become options, e.g.:: +Command line formats are what you would expect (``--myoption=myvalue`` +or ``--myflag`` in the case of boolean flags). Config files are just Python +files. Global names become options, e.g.:: myoption = "myvalue" myotheroption = "myothervalue" We support `datetimes `, `timedeltas -`, ints, and floats (just pass a ``type`` kwarg to +`, bools, ints, and floats (just pass a ``type`` kwarg to `define`). We also accept multi-value options. See the documentation for `define()` below. @@ -190,7 +191,7 @@ class OptionParser(object): multiple=False, group=None, callback=None): """Defines a new command line option. - If ``type`` is given (one of str, float, int, datetime, or timedelta) + If ``type`` is given (one of str, float, int, bool, datetime, or timedelta) or can be inferred from the ``default``, we parse the command line arguments based on the given type. If ``multiple`` is True, we accept comma-separated values, and the option value is always a list.