X-Git-Url: https://git.r.bdr.sh/rbdr/page/blobdiff_plain/1e2d00b62ecce95f71d4bfd60a043c8e86631eee..7a397dd96bd204d42e57c26d848222155d8a5390:/src/file_handler/file_strategies/gemini.rs diff --git a/src/file_handler/file_strategies/gemini.rs b/src/file_handler/file_strategies/gemini.rs index e69de29..2427422 100644 --- a/src/file_handler/file_strategies/gemini.rs +++ b/src/file_handler/file_strategies/gemini.rs @@ -0,0 +1,29 @@ +pub struct Strategy {} + +use std::path::PathBuf; + +use crate::file_handler::{File, FileType, FileHandlerStrategy}; + +impl FileHandlerStrategy for Strategy { + fn is(&self, path: &PathBuf) -> bool { + if let Some(extension) = path.extension() { + return !path.is_dir() && extension == "gmi" + } + false + } + + fn identify(&self) -> FileType { + FileType::Gemini + } + + fn can_handle(&self, file_type: &FileType) -> bool { + match file_type { + FileType::Gemini => true, + _ => false, + } + } + + fn handle(&self, source: &PathBuf, destination: &PathBuf, file: &File) { + println!("Should parse and copy {}", file.path.display()) + } +}