Skip to content
Myr

Added notes on callback changes to the docs

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent ebde9a0 · Browse files · 3 files+14 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+14 added−1 removed

  • other:+14 added−1 removed

3 files+14 added−1 removed

modified:click/core.py+2 added-1 removed
775 unmodified lines
776 in which case it's invoked when the default is needed777 without any arguments.778 :param callback: a callback that should be executed after the parameter779 was matched. This is called as ``fn(ctx, param,780 value)`` and needs to return the value.780 value)`` and needs to return the value. Before Click781 2.0 the signature was ``(ctx, value)``.782 :param nargs: the number of arguments to match. If not ``1`` the return783 value is a tuple instead of single value.784 :param metavar: how the value is represented in the help page.785 :param expose_value: if this is `True` then the value is passed onwards
421 unmodified lines
modified:docs/options.rst+10 added
323 unmodified lines
324325 invoke(hello)326 invoke(hello, args=['--version'])327328.. admonition:: Callback Signature Changes329330 In Click 2.0 the signature for callbacks changed. For more331 information about these changes see :ref:`upgrade-to-2.0`.332333Yes Parameters334--------------335336For dangerous operations it's very useful to be able to ask a user for
30 unmodified lines
367 @click.confirmation_option(help='Are you sure you want to drop the db?')368 def dropdb():369 click.echo('Dropped all tables!')370371.. admonition:: Callback Signature Changes372373 In Click 2.0 the signature for callbacks changed. For more374 information about these changes see :ref:`upgrade-to-2.0`.375376Values from Environment Variables377---------------------------------378379A very useful feature of click is the ability to accept parameters from
199 unmodified lines
modified:docs/upgrading.rst+2 added
4 unmodified lines
5this is not entirely possible. In case we need to break backwards6compatibility this document gives you information about how to upgrade or7handle backwards compatibility properly.89.. _upgrade-to-2.0:1011Upgrading to 2.012----------------1314Click 2.0 has one breaking change which is the signature for parameter
29 unmodified lines