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

Detect typos for options starting with en/em dash instead of -- #585

Open
joffrey-bion opened this issue Mar 24, 2025 · 0 comments
Open

Comments

@joffrey-bion
Copy link

joffrey-bion commented Mar 24, 2025

The -- prefix is extremely common in CLI options. When people communicate using markdown (e.g. in Slack or GitHub), it is possible that a -- gets rendered as some other kind of dash, like en-dash () or em-dash ().

The current Jaro-Winkler similarity metric is great for most things, but the threshold is not crossed for very short options like --dev. Therefore, someone trying –dev (rendered from --dev in markdown) will not see "Did you mean --dev?" but just a generic error instead.
EDIT: scratch that. After debugging, it looks like the CommandParser actually doesn't try to recognize this token as an option because of its first character. For the token –dev, the splitOptionPrefix function just considers the prefix to be "" instead of the en dash (it only knows about -@/+, which contains a real hyphen but not other types of dashes).

It would be nice to add a special case that compares options ignoring any kind of dash prefix.

@joffrey-bion joffrey-bion changed the title Add special case in similarity metric for typos affecting -- Detect typos for options starting with en/em dash instead of -- Mar 24, 2025
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

1 participant