Shorten a file path for summary display.
(path: &str)
| 717 | |
| 718 | /// Shorten a file path for summary display. |
| 719 | fn short_path(path: &str) -> String { |
| 720 | // If the path has more than 3 components, show last 2 |
| 721 | let components: Vec<&str> = path.split('/').collect(); |
| 722 | if components.len() > 3 { |
| 723 | components[components.len() - 2..].join("/") |
| 724 | } else { |
| 725 | path.to_string() |
| 726 | } |
| 727 | } |
| 728 | |
| 729 | /// Truncate a string for display. |
| 730 | fn truncate(s: &str, max_len: usize) -> String { |