diff --git a/src/google/adk/cli/cli_tools_click.py b/src/google/adk/cli/cli_tools_click.py index 1692cbf..1e32011 100644 --- a/src/google/adk/cli/cli_tools_click.py +++ b/src/google/adk/cli/cli_tools_click.py @@ -59,6 +59,19 @@ class HelpfulCommand(click.Command): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) + + @staticmethod + def _format_missing_arg_error(click_exception): + """Format the missing argument error with uppercase parameter name. + + Args: + click_exception: The MissingParameter exception from Click. + + Returns: + str: Formatted error message with uppercase parameter name. + """ + name = click_exception.param.name + return f"Missing required argument: {name.upper()}" def parse_args(self, ctx, args): """Override the parse_args method to show help text on error. @@ -77,8 +90,10 @@ class HelpfulCommand(click.Command): try: return super().parse_args(ctx, args) except click.MissingParameter as exc: + error_message = self._format_missing_arg_error(exc) + click.echo(ctx.get_help()) - click.secho(f"\nError: {str(exc)}", fg="red", err=True) + click.secho(f"\nError: {error_message}", fg="red", err=True) ctx.exit(2)