foundry_cli::utils::suggestions

Function did_you_mean

Source
pub fn did_you_mean<T, I>(v: &str, candidates: I) -> Vec<String>
where T: AsRef<str>, I: IntoIterator<Item = T>,
Expand description

Filters multiple strings from a given list of possible values which are similar to the passed in value v within a certain confidence by least confidence.

The jaro winkler similarity boosts candidates that have a common prefix, which is often the case in the event of typos. Thus, in a list of possible values like [“foo”, “bar”], the value “fop” will yield Some("foo"), whereas “blark” would yield None.