Skip to content

Commit

Permalink
Added Choice members documentation, versionadded, and slightly change…
Browse files Browse the repository at this point in the history
…d docstring.
  • Loading branch information
AndreasBackx committed Nov 3, 2024
1 parent 723b0c4 commit f500a8e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ Unreleased
- When using ``Option.envvar`` with ``Option.flag_value``, the ``flag_value``
will always be used instead of the value of the environment variable.
:issue:`2746` :pr:`2788`
- Add new method to ``Choice`` for getting a fail message and refactor
the convert method to use it.
- Add ``Choice.get_invalid_choice_message`` method for customizing the
invalid choice message.


Version 8.1.8
Expand Down
1 change: 1 addition & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ Types
.. autoclass:: Path

.. autoclass:: Choice
:members:

.. autoclass:: IntRange

Expand Down
2 changes: 1 addition & 1 deletion src/click/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ def get_invalid_choice_message(self, value: t.Any) -> str:
:param value: The invalid value.
:return: Error message for the invalid choice.
.. versionadded:: 8.2
"""
choices_str = ", ".join(map(repr, self.choices))
return ngettext(
Expand Down

0 comments on commit f500a8e

Please sign in to comment.