Skip to content

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

Open
@joffrey-bion

Description

@joffrey-bion

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions