Skip to content

How to display the full help of a command when an error occures? #1423

@electrotype

Description

@electrotype

Let's say an option is required but is missing. Commander then automatically displays a short "error: required option '--myOption' not specified" message. But what if, in addition to this message, I also want to display the full help of the command? Is this possible?

And, related question:

I do use exitOverride() and a big try/catch block. After parseAsync() has been called on a command with subcommands, is there a way to know what is the subcommand that was actually called? If an error occures and I could know the subcommand in my catch block, I guess I could display the help by myself (using subCommand.outputHelp()).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions