Skip to content

Commit

Permalink
Use the actual command being called in the error message
Browse files Browse the repository at this point in the history
Co-authored-by: Martin Prpič <[email protected]>
  • Loading branch information
raboof and mprpic committed Jun 25, 2024
1 parent ee95040 commit bc72a35
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cvelib/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,9 @@ def wrapped(*args: Any, **kwargs: Any) -> Callable:
click.echo("CVE record is not valid against the v5 JSON schema:")
for error in exc.errors:
click.echo(f" {error}")
click.echo("\nUse `cve <command> -h` for more information on how to use this command")
cmd_ctx = next((arg for arg in args if isinstance(arg, click.Context)), None)
cmd_name = cmd_ctx.command.name if cmd_ctx else "<command>"
click.echo(f"\nUse `cve {cmd_name} -h` for more information on how to use this command")
sys.exit(1)

return wrapped
Expand Down

0 comments on commit bc72a35

Please sign in to comment.