pub fn shorten_path(path: &str, max_length: usize) -> String {
if path.len() <= max_length {
return path.to_string();
}
let components: Vec<&str> = path.split('/').filter(|s| !s.is_empty()).collect();
if components.len() <= 2 {
return path.to_string();
}
let prefix = if path.starts_with("./") { "./" } else { "" };
format!(
"{}.../{}/{}",
prefix,
components[components.len() - 2],
components[components.len() - 1]
)
}