rewrite most of the handler code :3

This commit is contained in:
2025-11-13 20:02:22 +04:00
parent 52d6137c05
commit 0f725073d8
13 changed files with 1585 additions and 281 deletions

View File

@@ -1,6 +1,6 @@
const NIX_STORE_PREFIX: &str = "/nix/store/";
const NIX_HASH_LENGTH: usize = 32;
pub fn extract_package_name(path: &str) -> Option<String> {
pub fn extract_package_name(path: &str) -> Option<Vec<&str>> {
let without_prefix = path.strip_prefix(NIX_STORE_PREFIX)?;
if without_prefix.len() <= NIX_HASH_LENGTH + 1 {
@@ -24,7 +24,10 @@ pub fn extract_package_name(path: &str) -> Option<String> {
return None;
}
Some(name_parts.join("-"))
Some(name_parts)
}
pub fn extract_package_name_string(path: &str) -> Option<String> {
extract_package_name(path).map(|f| f.join("-"))
}
pub fn extract_full_name(path: &str) -> Option<&str> {