Method
convert
(self, value: bool | str, param: click.Parameter | None, ctx: click.Context | None)
Source from the content-addressed store, hash-verified
| 9 | name = "confirmation" |
| 10 | |
| 11 | def convert(self, value: bool | str, param: click.Parameter | None, ctx: click.Context | None) -> bool: |
| 12 | if isinstance(value, bool): |
| 13 | return bool(value) |
| 14 | value = value.lower() |
| 15 | if value in ("yes", "y"): |
| 16 | return True |
| 17 | if value in ("no", "n"): |
| 18 | return False |
| 19 | self.fail(f'{value} is not a valid boolean', param, ctx) |
| 20 | |
| 21 | def __repr__(self): |
| 22 | return "BOOL" |