Extract file extension from a file path. Returns "txt" if no extension is found.
(path: &str)
| 181 | /// Extract file extension from a file path. |
| 182 | /// Returns "txt" if no extension is found. |
| 183 | pub fn ext_from_path(path: &str) -> &str { |
| 184 | path.rsplit('.') |
| 185 | .next() |
| 186 | .filter(|ext| ext.len() <= 10 && !ext.contains('/') && !ext.contains('\\')) |
| 187 | .unwrap_or("txt") |
| 188 | } |
| 189 | |
| 190 | /// Convert a syntect Style to a ratatui Style. |
| 191 | fn syntect_to_ratatui_style(style: &SyntectStyle) -> Style { |
no test coverage detected