Cli: Feature: "Did you mean" hint on wrong command or flag

Created on 13 Sep 2019  路  13Comments  路  Source: urfave/cli

We could tell the user what the closest command or argument match is by calculating the levenshtein distance between them.

What to do you think?

arev2 kinfeature statuconfirmed statustale

All 13 comments

Should be optional tho

Good idea for a new feature. I always loved how git suggests this to us in case of a typo. I also agree that this needs to be optional where a user can enable this probably by a boolean flag if they feel they need it for their CLI.

I'd love this!!!

Related to the conversation in https://github.com/urfave/cli/issues/826, I'd like to propose we only consider this feature for v2 馃檹

Sounds good, I suggest to use a third party library to provide the necessary algorithms around it.

Sounds good, I suggest to use a third party library to provide the necessary algorithms around it.

I'm in strong agreement here!

I found three main packages which all seem a bit unmaintained:

From an implementation perspective I tend to use the Jaro-Winkler distance to match the closet command/flag.

To start with a clean state I added go module support to matchr: https://github.com/antzucaro/matchr/pull/10

This issue or PR has been automatically marked as stale because it has not had recent activity. Please add a comment bumping this if you're still interested in it's resolution! Thanks for your help, please let us know if you need anything else.

Closing this as it has become stale.

This issue or PR has been bumped and is no longer marked as stale! Feel free to bump it again in the future, if it's still relevant.

This issue has a PR here! => https://github.com/urfave/cli/pull/977

This issue or PR has been automatically marked as stale because it has not had recent activity. Please add a comment bumping this if you're still interested in it's resolution! Thanks for your help, please let us know if you need anything else.

Closing this as it has become stale.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mponton picture mponton  路  5Comments

Zyko0 picture Zyko0  路  6Comments

lynncyrin picture lynncyrin  路  3Comments

blackrez picture blackrez  路  5Comments

krostar picture krostar  路  5Comments