summaryrefslogtreecommitdiff
path: root/docs/options.rst
diff options
context:
space:
mode:
authorEric L Frederich <eric.frederich@gmail.com>2017-05-22 08:59:42 -0400
committerEric L Frederich <eric.frederich@gmail.com>2017-05-22 09:06:35 -0400
commita653585fa7932726a3309b69d79b7067466e961d (patch)
tree288db1acd103fee5ce1916f8bd7637987ec6b567 /docs/options.rst
parent945b4d38a323e8957df04ca371e7e032f930179e (diff)
downloadclick-a653585fa7932726a3309b69d79b7067466e961d.tar.gz
Option naming: add test and documentation for existing functionality
Diffstat (limited to 'docs/options.rst')
-rw-r--r--docs/options.rst14
1 files changed, 12 insertions, 2 deletions
diff --git a/docs/options.rst b/docs/options.rst
index 2a01802..dd61e5b 100644
--- a/docs/options.rst
+++ b/docs/options.rst
@@ -16,8 +16,9 @@ Basic Value Options
The most basic option is a value option. These options accept one
argument which is a value. If no type is provided, the type of the default
value is used. If no default value is provided, the type is assumed to be
-:data:`STRING`. By default, the name of the parameter is the first long
-option defined; otherwise the first short one is used.
+:data:`STRING`. Unless a name is explicitly specified, the name of the
+parameter is the first long option defined; otherwise the first short one is
+used.
.. click:example::
@@ -26,6 +27,15 @@ option defined; otherwise the first short one is used.
def dots(n):
click.echo('.' * n)
+.. click:example::
+
+ # How to use a Python reserved word such as `from` as a parameter
+ @click.command()
+ @click.option('--from', '-f', '_from')
+ @click.option('--to', '-t')
+ def reserved_param_name(_from, to):
+ click.echo('from %s to %s' % (_from, to))
+
And on the command line:
.. click:run::