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

Suggest matching arguments if the user mistypes #1210

Closed
jamesgeorge007 opened this issue Feb 8, 2020 · 11 comments
Closed

Suggest matching arguments if the user mistypes #1210

jamesgeorge007 opened this issue Feb 8, 2020 · 11 comments

Comments

@jamesgeorge007
Copy link
Member

jamesgeorge007 commented Feb 8, 2020

Is your feature request related to a problem? Please describe.
Say the user makes a typo, webpack-cli --confgi as of now he'll be greeted with a warning such that the respective argument is not recognized.

Describe the solution you'd like
Suggest the nearest matching argument.

Describe alternatives you've considered
Levenshtein distance algorithm.

Additional context
Screenshot from 2020-02-08 21-58-42

@ematipico
Copy link
Contributor

ematipico commented Feb 9, 2020

What about cases of multiple argument that are mistyped or providing multiple arguments and just one is mistyped? How would that work?

@anshumanv
Copy link
Member

To what extent are we checking that a flag is a mistype and matches some arg/flag? How is the diff of closest matching flag evaluated?

@rishabh3112
Copy link
Member

I feel that a warning for wrong arguments is enough.

P.S.

To what extent are we checking that a flag is a mistype and matches some arg/flag? How is the diff of closest matching flag evaluated?

Using https://en.wikipedia.org/wiki/Levenshtein_distance

@jamesgeorge007
Copy link
Member Author

jamesgeorge007 commented Feb 9, 2020

What about cases of multiple argument that are mistyped or providing multiple arguments and just one is mistyped? How would that work?

We're just taking the very first argument into account.
https://github.com/jamesgeorge007/webpack-cli/blob/e35c24f06d527a3e27663babcca1dd1c083e5f95/lib/bootstrap.js#L73

@jamesgeorge007
Copy link
Member Author

I feel that a warning for wrong arguments is enough.

This is essentially an addition on top of what we already have onboard. Getting suggestions is definitely gonna add to the UX.

@anshumanv
Copy link
Member

Using https://en.wikipedia.org/wiki/Levenshtein_distance

Saw the repo. 👍

I think showing help with warning in case any invalid flag is supplied is sufficient feedback. #1051

@ematipico
Copy link
Contributor

ematipico commented Feb 9, 2020

How would that work with alias? -d or -c

@jamesgeorge007
Copy link
Member Author

As of now it just checks for the fully qualified flag names ignoring aliases. #1211

@ematipico
Copy link
Contributor

ematipico commented Feb 13, 2020

We're just taking the very first argument into account

Which is not ideal. If user passes a series of parameters and the last one is wrong, the feature would fail. It should check all the arguments

@jamesgeorge007
Copy link
Member Author

In-fact the very first unknown argument.

@jamesgeorge007 jamesgeorge007 changed the title Suggest matching option flags if the user mistypes Suggest matching arguments if the user mistypes Feb 19, 2020
@jamesgeorge007
Copy link
Member Author

closing in regard to #1255

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

Successfully merging a pull request may close this issue.

4 participants