aboutsummaryrefslogtreecommitdiff
path: root/src/file_handler/file_strategies/gemini.rs
blob: ffa2a9f1e8a0930cafa1f6f691f710ca80f8f53f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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())
    }
}