Skip to content

fix: suggest --help when an unknown or unexpected CLI argument is passed #400

@sonukapoor

Description

@sonukapoor

Problem

When a user passes an unknown flag or unexpected argument, the error message only states what went wrong:

Error: Unknown option: --verbosse

There is no hint that they can run --help to see valid options. This is especially confusing for new users who mistype a flag.

Expected behaviour

Error: Unknown option: --verbosse
Run `cve-lite --help` to see supported options.

The same hint should appear for Unexpected argument: <value>.

Where to look

src/cli/args.ts — the Unknown option and Unexpected argument throw sites. The outer catch block in src/index.ts already appends the --help hint for argument errors, so this may just need a check that these error messages are routed through that handler correctly, or the hint can be added directly to the throw message.

Acceptance criteria

  • cve-lite --verbosse prints the error followed by Run \cve-lite --help` to see supported options.`
  • cve-lite . extra-arg prints the same trailing hint
  • Existing tests pass

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions