summaryrefslogtreecommitdiff
path: root/docs/options.rst
diff options
context:
space:
mode:
authorDaw-Ran Liou <dawran6@gmail.com>2018-05-16 18:45:32 -0700
committerDaw-Ran Liou <dawran6@gmail.com>2018-05-16 18:45:32 -0700
commit559eb58a1f1a8ebf5c3f17d7e5009e3827704876 (patch)
tree09fa7231fa0fd863845a5f83619758c2ea087214 /docs/options.rst
parentf27a8dfee2d89c0d9787ed0deaf2d0ea50fadc8e (diff)
downloadclick-559eb58a1f1a8ebf5c3f17d7e5009e3827704876.tar.gz
Fix issue #725
Diffstat (limited to 'docs/options.rst')
-rw-r--r--docs/options.rst22
1 files changed, 22 insertions, 0 deletions
diff --git a/docs/options.rst b/docs/options.rst
index 125ee44..46b6f99 100644
--- a/docs/options.rst
+++ b/docs/options.rst
@@ -10,6 +10,28 @@ decorator. Since options can come in various different versions, there
are a ton of parameters to configure their behavior. Options in click are
distinct from :ref:`positional arguments <arguments>`.
+Name Your Options
+-----------------
+
+The naming rules can be found in :ref:`parameter_names`. In short, you
+can refer the option **implicitly** by the longest dash-prefixed argument:
+
+.. click:example::
+
+ @click.command()
+ @click.option('-s', '--string-to-echo')
+ def echo(string_to_echo):
+ click.echo(string_to_echo)
+
+Or, **explicitly**, by giving one non-dash-prefixed argument:
+
+.. click:example::
+
+ @click.command()
+ @click.option('-s', '--string-to-echo', 'string')
+ def echo(string):
+ click.echo(string)
+
Basic Value Options
-------------------