| 21 | |
| 22 | |
| 23 | class IntOrStringClickParamType(click.ParamType): |
| 24 | name = 'text' # display as TEXT in helpdoc |
| 25 | |
| 26 | def convert(self, value, param, ctx): |
| 27 | if isinstance(value, int): |
| 28 | return value |
| 29 | elif isinstance(value, str): |
| 30 | return value |
| 31 | elif value is None: |
| 32 | return value |
| 33 | else: |
| 34 | self.fail('Not a valid password string', param, ctx) |
| 35 | |
| 36 | |
| 37 | INT_OR_STRING_CLICK_TYPE = IntOrStringClickParamType() |