Override the parse_args method to show help text on error. Args: ctx: Click context object for the current command. args: List of command-line arguments to parse. Returns: The parsed arguments as returned by the parent class's parse_args method. Raises: click.M
(self, ctx, args)
| 197 | return f"Missing required argument: {name.upper()}" |
| 198 | |
| 199 | def parse_args(self, ctx, args): |
| 200 | """Override the parse_args method to show help text on error. |
| 201 | |
| 202 | Args: |
| 203 | ctx: Click context object for the current command. |
| 204 | args: List of command-line arguments to parse. |
| 205 | |
| 206 | Returns: |
| 207 | The parsed arguments as returned by the parent class's parse_args method. |
| 208 | |
| 209 | Raises: |
| 210 | click.MissingParameter: When a required parameter is missing, but this |
| 211 | is caught and handled by displaying the help text before exiting. |
| 212 | """ |
| 213 | try: |
| 214 | return super().parse_args(ctx, args) |
| 215 | except click.MissingParameter as exc: |
| 216 | error_message = self._format_missing_arg_error(exc) |
| 217 | |
| 218 | click.echo(ctx.get_help()) |
| 219 | click.secho(f"\nError: {error_message}", fg="red", err=True) |
| 220 | ctx.exit(2) |
| 221 | |
| 222 | |
| 223 | logger = logging.getLogger("google_adk." + __name__) |
no test coverage detected