This is relevant only for Click 8.0.1, since the following line was introduced in PR #1913:
|
self.is_bool_flag = isinstance(self.type, types.BoolParamType) |
The solution is as easy as:
self.is_bool_flag = self.is_flag and isinstance(self.type, types.BoolParamType)
Available to open a PR.
Demonstration code
import click
@click.command()
@click.option('--switch', type=bool)
def f(switch):
print(switch)
if __name__ == '__main__':
assert not f.params[0].is_flag
assert f.params[0].is_bool_flag
f('--switch'.split())
Error: Option '--switch' requires an argument.
This is relevant only for Click 8.0.1, since the following line was introduced in PR #1913:
click/src/click/core.py
Line 2531 in af0af57
The solution is as easy as:
Available to open a PR.
Demonstration code