]> git.r.bdr.sh - rbdr/page/blobdiff - src/file_handler/file_strategies/gemini.rs
Add basic strategies
[rbdr/page] / src / file_handler / file_strategies / gemini.rs
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..ffa2a9f1e8a0930cafa1f6f691f710ca80f8f53f 100644 (file)
@@ -0,0 +1,26 @@
+pub struct Strategy {}
+
+use std::path::PathBuf;
+
+use crate::file_handler::{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, path: &PathBuf) -> bool {
+        self.is(path)
+    }
+
+    fn handle(&self, path: &PathBuf) {
+        println!("Should convert {}", path.display())
+    }
+}