Skip to content

Customizable error message for bad commandΒ #250

@theoephraim

Description

@theoephraim

Clear and concise description of the problem

Currently when a user runs a bad subcommand, we get a basic error message like Error: Command not found: badcommand with a stacktrace.

As a CLI author, I want to give some nicer output with a recommendation to use the help command.

Suggested solution

Of course we could let the user define a specific hook/handler for this exact case, but even simpler, we can just throw a specific error class that the end user can then check for with instanceof. You could imagine then customizing a message, or even adding specific notices about deprecated subcommands, or common typos.

Alternative

I can currently look for an error message starting with Command not found: but this is not ideal.

Additional context

No response

Validations

  • Read the Contributing Guide.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureIncludes new features🍰 p2-nice-to-havePriority 2: nothing is broken but it's worth addressing

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions