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

chore: migrate to leven for command suggestion #5166

Merged
merged 6 commits into from Feb 13, 2020

Conversation

jamesgeorge007
Copy link
Contributor

@jamesgeorge007 jamesgeorge007 commented Feb 8, 2020

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Docs
  • Underlying tools
  • Other, please describe:

closes #5164

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

Other information:
N/A

@jamesgeorge007 jamesgeorge007 changed the title chore(deps): switch to leven for command suggestion chore(deps): switch over to leven for command suggestion Feb 8, 2020
@jamesgeorge007 jamesgeorge007 changed the title chore(deps): switch over to leven for command suggestion chore: switch over to leven for command suggestion Feb 8, 2020
packages/@vue/cli/bin/vue.js Outdated Show resolved Hide resolved
@sodatea
Copy link
Member

sodatea commented Feb 13, 2020

Try the two commands:
vue infi and vue iniy
Should return vue info and vue init respectively.

@jamesgeorge007
Copy link
Contributor Author

Try the two commands:
vue infi and vue iniy
Should return vue info and vue init respectively.

    if (leven(cmd, unknownCommand) < 2) {

This would do that.

@sodatea
Copy link
Member

sodatea commented Feb 13, 2020

But it's not the best fix

@sodatea
Copy link
Member

sodatea commented Feb 13, 2020

The ideal algorithm is to find the closest command, regardless of the distance. (You can set a threshold to stop suggesting when even the closest command is too unrelated, though)

@sodatea sodatea merged commit 130bcfb into vuejs:dev Feb 13, 2020
@jamesgeorge007 jamesgeorge007 deleted the chore/leven branch February 13, 2020 09:34
@jamesgeorge007 jamesgeorge007 changed the title chore: switch over to leven for command suggestion chore: migrate to leven for command suggestion Sep 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Switch over to leven for command suggestion
2 participants