MCPcopy Create free account
hub / github.com/GCWing/BitFun / ext_from_path

Function ext_from_path

src/apps/cli/src/ui/syntax_highlight.rs:183–188  ·  view source on GitHub ↗

Extract file extension from a file path. Returns "txt" if no extension is found.

(path: &str)

Source from the content-addressed store, hash-verified

181/// Extract file extension from a file path.
182/// Returns "txt" if no extension is found.
183pub 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.
191fn syntect_to_ratatui_style(style: &SyntectStyle) -> Style {

Callers 1

render_write_blockFunction · 0.85

Calls 3

nextMethod · 0.80
lenMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected