Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Improve Error Message for Unrecognized Commands #1021

Open
krepysh opened this issue Feb 5, 2025 · 0 comments
Open

Feature Request: Improve Error Message for Unrecognized Commands #1021

krepysh opened this issue Feb 5, 2025 · 0 comments

Comments

@krepysh
Copy link

krepysh commented Feb 5, 2025

Currently, when a user mistypes a command, invoke returns a message like:

$ invoke some_cmd
No idea what 'some_cmd' is!

This error message does not provide any guidance on what the user might have intended. Many modern CLI tools, such as git, offer helpful suggestions when a command is not recognised. For example:

$ git comment
git: 'comment' is not a git command. See 'git --help'.

The most similar command is
        commit

I propose enhancing invoke to display similar suggestions when an unknown command is entered.
On a technical side it seems doable by using Levenshtein distance, or any other kind of edit distance.

Proposal

Implement not fixed matching algorithm to suggest most similar known commands.

Modify the error message to guide the user, e.g.:

$ invoke some_cmd
'some_cmd' is not an invoke command. See 'invoke --help'.

The most similar command is
        some_command

If multiple similar matches exist, list them in descending order of similarity.

Alternatives Considered:

If this feature is seems to be out of scope for invoke, could you provide guidance on how to extend invoke to achieve this behaviour?
I can find places in code where parsing happens, but I'm not sure how to extend code properly for covering that case.

This improvement would enhance usability and reduce frustration for users who mistype commands.

Would this be a feature you’d consider for invoke? If not, any pointers on implementing it as an extension would be greatly appreciated!

Thanks for your time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant