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

cli: add help for incorrectly spelled commands #3725

Open
jessekelly881 opened this issue Oct 3, 2024 · 0 comments
Open

cli: add help for incorrectly spelled commands #3725

jessekelly881 opened this issue Oct 3, 2024 · 0 comments
Labels
cli enhancement New feature or request

Comments

@jessekelly881
Copy link
Contributor

jessekelly881 commented Oct 3, 2024

What is the problem this feature would solve?

When a user incorrectly type a cli argument it would be ideal if the cli helped the user find the right command instead of erroring. Git and many other cli tools tell the user what command they might be thinking of and some prompt the user to run the suggested command instead. For example, if you run git comit` git will reply with

git: 'comit' is not a git command. See 'git --help'.

The most similar command is
        commit

At the moment the effect cli just errors.

Compare:
Screenshot 2024-10-03 at 3 04 46 PM

to:
Screenshot 2024-10-03 at 3 05 14 PM

What is the feature you are proposing to solve the problem?

I think we should handle this case better. When effect cli detects that the user incorrectly typed either a command or an argument it should suggest the closest command name (if one is close enough) and ask the user if they want to run that instead using a yes/no prompt.

This should be done automatically by the effect cli framework without the cli implementer having to change anything.

https://www.npmjs.com/package/didyoumean2

What alternatives have you considered?

Implementing this manually for every cli is possible but is not fun..

@jessekelly881 jessekelly881 added the enhancement New feature or request label Oct 3, 2024
@gcanti gcanti added the cli label Oct 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants