mirror of
https://github.com/TECHNOFAB11/pay-respects.git
synced 2025-12-12 06:20:09 +01:00
fix: relative path rules
This commit is contained in:
parent
b332ca4dfb
commit
ee7b270d9c
4 changed files with 14 additions and 3 deletions
|
|
@ -76,6 +76,14 @@ pub fn suggest_typo(typos: &[String], candidates: Vec<String>, executables: &[St
|
|||
if candidates.len() == 1 {
|
||||
match candidates[0].as_str() {
|
||||
"path" => {
|
||||
if typo.contains(std::path::MAIN_SEPARATOR) {
|
||||
if let Some(suggest) = best_match_file(typo) {
|
||||
suggestions.push(suggest);
|
||||
} else {
|
||||
suggestions.push(typo.to_string());
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if let Some(suggest) = find_similar(typo, executables, Some(2)) {
|
||||
suggestions.push(suggest);
|
||||
} else {
|
||||
|
|
@ -89,7 +97,9 @@ pub fn suggest_typo(typos: &[String], candidates: Vec<String>, executables: &[St
|
|||
suggestions.push(typo.to_string());
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
_ => {
|
||||
unreachable!("suggest_typo: must have at least two candidates")
|
||||
}
|
||||
}
|
||||
} else if let Some(suggest) = find_similar(typo, &candidates, Some(2)) {
|
||||
suggestions.push(suggest);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue