mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-15 20:05:13 +02:00
15 lines
479 B
Rust
15 lines
479 B
Rust
|
|
pub fn lowercase_ext(path: &std::path::Path) -> Option<&'static str> {
|
||
|
|
path.extension()
|
||
|
|
.and_then(|s| match s.to_str()? {
|
||
|
|
"rs" | "RS" => Some("rs"),
|
||
|
|
"c" => Some("c"),
|
||
|
|
"cpp" | "c++" => Some("cpp"),
|
||
|
|
"java" => Some("java"),
|
||
|
|
"go" => Some("go"),
|
||
|
|
"php" => Some("php"),
|
||
|
|
"py" | "PY" => Some("py"),
|
||
|
|
"ts" | "TSX" | "tsx" => Some("ts"),
|
||
|
|
"js" => Some("js"),
|
||
|
|
_ => None,
|
||
|
|
})
|
||
|
|
}
|