| 205 | ctx.set_parameter_source(param_name, ParameterSource.DEFAULT_MAP) |
| 206 | |
| 207 | def invoke(self, ctx): |
| 208 | if self.use_option_parsers is True: |
| 209 | for parser in self._extra_parsers: |
| 210 | parser_value = ctx.params[parser.name] |
| 211 | if parser_value is not None: |
| 212 | parser_source = ctx.get_parameter_source(parser.name) |
| 213 | try: |
| 214 | parse_result = parser.parse(ctx, parser_value, parser_source) |
| 215 | for param_name, value in ctx.params.items(): |
| 216 | source = ctx.get_parameter_source(param_name) |
| 217 | parser_value = parse_result.get(param_name) |
| 218 | if parser_value is not None: |
| 219 | param = self.opt_name_to_param[param_name] |
| 220 | with augment_usage_errors(ctx, param=param): |
| 221 | try: |
| 222 | parsed_value = param.process_value(ctx, parser_value) |
| 223 | if param.callback is not None: |
| 224 | value = param.callback(ctx, param, parsed_value) |
| 225 | except Exception: |
| 226 | if not ctx.resilient_parsing: |
| 227 | raise |
| 228 | parsed_value = None |
| 229 | |
| 230 | if param.expose_value: |
| 231 | self._process_parse_result( |
| 232 | ctx, param_name, source, value, parsed_value |
| 233 | ) |
| 234 | except SkipParsing: |
| 235 | ctx.params[parser.name] = None |
| 236 | ctx.set_parameter_source(parser.name, ParameterSource.DEFAULT_MAP) |
| 237 | |
| 238 | return super().invoke(ctx) |
| 239 | |
| 240 | def format_options(self, ctx, formatter): |
| 241 | GroupableOptionCommand.format_options(self, ctx, formatter) # type: ignore |