diff --git a/crates/nu-protocol/src/shell_error.rs b/crates/nu-protocol/src/shell_error.rs index b80cc30cf2..7e1a8fa7b8 100644 --- a/crates/nu-protocol/src/shell_error.rs +++ b/crates/nu-protocol/src/shell_error.rs @@ -360,6 +360,15 @@ impl From> for ShellError { } pub fn did_you_mean(possibilities: &[String], tried: &str) -> Option { + // First see if we can find the same string just cased differently + let great_match_index = possibilities + .iter() + .position(|word| word.to_lowercase() == tried.to_lowercase()); + + if let Some(index) = great_match_index { + return Some(possibilities[index].to_owned()); + } + let mut possible_matches: Vec<_> = possibilities .iter() .map(|word| {