opam icon indicating copy to clipboard operation
opam copied to clipboard

Add package spelling hints

Open arozovyk opened this issue 1 year ago • 1 comments

This PR adds hints when package names contain typos. When the package is not found, string edit distance is used to spellcheck the name and the closest package is printed to the user.

Currently hinted commands :

  • [x] remove
  • [x] info/show
  • [x] source
  • [x] install
  • [x] upgrade
  • [x] reinstall
  • [x] pin (version/current/dev/edit)
  • [x] tree
  • [x] lock
  • [x] switch set-invariant
$./opam source ocamlforat   
[ERROR] No package matching ocamlforat found.

Hint: Did you mean ocamlformat?

Multi-hints:

$./opam info ocamlforat opclib-endian baze 

[ERROR] No package matching ocamlforat or opclib-endian or baze found

Hint: Did you mean ocamlformat?

Hint: Did you mean ocplib-endian?

Hint: Did you mean bare?

closes #4029

arozovyk avatar Mar 26 '25 16:03 arozovyk

Added hints for : pin : edit, --dev-repo --current remove —force (unforced remove is already covered).

arozovyk avatar Mar 28 '25 13:03 arozovyk