You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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
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
, thesplitOptionPrefix
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.
The text was updated successfully, but these errors were encountered: