mirror of
https://github.com/kristoferssolo/project-finder.git
synced 2025-10-21 19:50:35 +00:00
27 lines
707 B
Rust
27 lines
707 B
Rust
use std::{convert::Infallible, str::FromStr};
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
pub enum MarkerType {
|
|
PackageJson,
|
|
CargoToml,
|
|
DenoJson,
|
|
BuildFile(String),
|
|
OtherConfig(String),
|
|
}
|
|
|
|
impl FromStr for MarkerType {
|
|
type Err = Infallible;
|
|
|
|
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
|
|
Ok(match s {
|
|
"package.json" => Self::PackageJson,
|
|
"Cargo.toml" => Self::CargoToml,
|
|
"deno.json" | "deno.jsonc" => Self::DenoJson,
|
|
"Makefile" | "CMakeLists.txt" | "justfile" | "Justfile" => {
|
|
Self::BuildFile(s.to_string())
|
|
}
|
|
_ => Self::OtherConfig(s.to_string()),
|
|
})
|
|
}
|
|
}
|