Skip to content

Improve error message for "unknown commands" for well-known sub commands #4880

@MylesBorins

Description

@MylesBorins

Describe the feature or problem you’d like to solve

As a long time hub user I have tried to run gh fork a number of times to be reminded that I have to run gh repo fork.

I was informed that i could make an alias to avoid this error in the future by @mislav.

gh alias set fork "repo fork"

Would be great to see if we could impart similar wisdom automatically as part of the error message.

Proposed solution

When a unknown command is provided but it is a well known subcommand such as fork we could provide a slightly more actionable error message such as

$ gh fork
unknown command "fork" for "gh", did you mean to run "gh repo fork"?

You can create a an alias for this command with the following command
`gh alias set fork "repo fork"`

Additional context

Add any other context like screenshots or mockups are helpful, if applicable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementa request to improve CLIgh-aliasrelated to the gh alias commandhelp wantedContributions welcome

    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