summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Lord <davidism@gmail.com>2022-04-28 10:36:54 -0700
committerDavid Lord <davidism@gmail.com>2022-04-28 10:36:54 -0700
commit0aec1168ac591e159baf6f61026d6ae322c53aaf (patch)
treec64a76ba04d872d79f7bc75ca3dd1d4ba9c7ebee /src
parent6bd8e56de957a423a707362cecfe2d5560afba0b (diff)
parent9c6f4c8e1bb8670ce827c98559f57f6ee5935cd0 (diff)
downloadclick-0aec1168ac591e159baf6f61026d6ae322c53aaf.tar.gz
Merge branch '8.1.x'
Diffstat (limited to 'src')
-rw-r--r--src/click/core.py3
-rw-r--r--src/click/decorators.py8
2 files changed, 7 insertions, 4 deletions
diff --git a/src/click/core.py b/src/click/core.py
index a9a72c5..5abfb0f 100644
--- a/src/click/core.py
+++ b/src/click/core.py
@@ -2580,6 +2580,9 @@ class Option(Parameter):
if self.is_flag:
raise TypeError("'count' is not valid with 'is_flag'.")
+ if self.multiple and self.is_flag:
+ raise TypeError("'multiple' is not valid with 'is_flag', use 'count'.")
+
def to_info_dict(self) -> t.Dict[str, t.Any]:
info_dict = super().to_info_dict()
info_dict.update(
diff --git a/src/click/decorators.py b/src/click/decorators.py
index ef1b1a5..28618dc 100644
--- a/src/click/decorators.py
+++ b/src/click/decorators.py
@@ -149,7 +149,7 @@ def command(
def command(
- name: t.Union[str, t.Callable, None] = None,
+ name: t.Union[str, t.Callable[..., t.Any], None] = None,
cls: t.Optional[t.Type[Command]] = None,
**attrs: t.Any,
) -> t.Union[Command, t.Callable[..., Command]]:
@@ -182,7 +182,7 @@ def command(
appended to the end of the list.
"""
- func: t.Optional[t.Callable] = None
+ func: t.Optional[t.Callable[..., t.Any]] = None
if callable(name):
func = name
@@ -228,7 +228,7 @@ def command(
@t.overload
def group(
- __func: t.Callable,
+ __func: t.Callable[..., t.Any],
) -> Group:
...
@@ -242,7 +242,7 @@ def group(
def group(
- name: t.Union[str, t.Callable, None] = None, **attrs: t.Any
+ name: t.Union[str, t.Callable[..., t.Any], None] = None, **attrs: t.Any
) -> t.Union[Group, t.Callable[[F], Group]]:
"""Creates a new :class:`Group` with a function as callback. This
works otherwise the same as :func:`command` just that the `cls`