]> git.r.bdr.sh - rbdr/page/blob - src/file_handler/file_strategies/gemini.rs
Add static file copying
[rbdr/page] / src / file_handler / file_strategies / gemini.rs
1 pub struct Strategy {}
2
3 use std::path::PathBuf;
4
5 use crate::file_handler::{File, FileType, FileHandlerStrategy};
6
7 impl FileHandlerStrategy for Strategy {
8 fn is(&self, path: &PathBuf) -> bool {
9 if let Some(extension) = path.extension() {
10 return !path.is_dir() && extension == "gmi"
11 }
12 false
13 }
14
15 fn identify(&self) -> FileType {
16 FileType::Gemini
17 }
18
19 fn can_handle(&self, file_type: &FileType) -> bool {
20 match file_type {
21 FileType::Gemini => true,
22 _ => false,
23 }
24 }
25
26 fn handle(&self, source: &PathBuf, destination: &PathBuf, file: &File) {
27 println!("Should parse and copy {}", file.path.display())
28 }
29 }