From f8420314729e03e31845582ea9278d16ccf7832e Mon Sep 17 00:00:00 2001 From: "Michael V. DePalatis" Date: Tue, 26 Dec 2017 20:40:43 -0600 Subject: [PATCH] Document that options can be booleans Addresses #2222 --- tornado/options.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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. -- 2.47.2