mirror of
https://github.com/edera-dev/sprout.git
synced 2025-12-19 21:20:17 +00:00
implement support for filesystem extractor mechanism
This commit is contained in:
20
src/extractors.rs
Normal file
20
src/extractors.rs
Normal 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");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user