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

[Proposal] Implement a "Did you mean?" feature #41

Closed
javiereguiluz opened this issue Apr 6, 2017 · 2 comments
Closed

[Proposal] Implement a "Did you mean?" feature #41

javiereguiluz opened this issue Apr 6, 2017 · 2 comments

Comments

@javiereguiluz
Copy link
Member

If you don't provide a valid alias (e.g. "server" for "symfony/web-server-bundle") or Symfony package name (e.g. "monolog-bundle" for "symfony/monolog-bundle") or a Composer package name (e.g. "fabpot/flex"), you see this error:

$ composer req sec

  [InvalidArgumentException]
  Could not find package sec at any version for your minimum-stability (dev).
  Check the package spelling or your minimum-stability

This is what I expected:

$ composer req sec

  [InvalidArgumentException]
  Could not find package "sec". Did you mean: "security" or "security-checker"?

In practice:

  • This would only work when the user input doesn't contain a "/". Otherwise they are trying to install a Composer package and we should not fix them (e.g. "sec" -> did you mean "security"? but "foo/sec" -> Composer error)
  • This would only show the 2 or 3 best alternatives.
  • If we don't want to easily disclose the available aliases, this would only work if the user typed at least 3 chars (to avoid typing "a" to get those aliases, then "b", etc.)
@fabpot
Copy link
Member

fabpot commented Apr 6, 2017

It's not easy as the argument might be a package name or a version like in composer req twig 2.3. Here 2.3 is the version for Twig, not another package. Will see what I can do though.

@fabpot
Copy link
Member

fabpot commented Apr 6, 2017

Fixed in b8bcfaf

@fabpot fabpot closed this as completed Apr 6, 2017
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

2 participants