implement support for filesystem extractor mechanism

This commit is contained in:
2025-10-13 00:55:11 -07:00
parent aba53c0d2b
commit 7a63e0325b
10 changed files with 237 additions and 28 deletions

20
src/extractors.rs Normal file
View File

@@ -0,0 +1,20 @@
use crate::context::SproutContext;
use crate::extractors::filesystem::FileSystemExtractorConfiguration;
use anyhow::{Result, bail};
use serde::{Deserialize, Serialize};
use std::rc::Rc;
pub mod filesystem;
#[derive(Serialize, Deserialize, Default, Clone)]
pub struct ExtractorDeclaration {
pub filesystem: Option<FileSystemExtractorConfiguration>,
}
pub fn extract(context: Rc<SproutContext>, extractor: &ExtractorDeclaration) -> Result<String> {
if let Some(filesystem) = &extractor.filesystem {
filesystem::extract(context, filesystem)
} else {
bail!("unknown extractor configuration");
}
}