~savoy/mailcap

96bff3b50241d78233e0ab49eb32acca5e62feba — savoy 2 years ago 6b8eb21
pull an Entry from Mailcap based on mime_type key

Signed-off-by: savoy <git@liberation.red>
1 files changed, 5 insertions(+), 2 deletions(-)

M src/lib.rs
M src/lib.rs => src/lib.rs +5 -2
@@ 34,7 34,7 @@ pub struct Mailcap {
}

#[derive(Default, Debug, PartialEq)]
struct Entry {
pub struct Entry {
    mime_type: String,
    command: Vec<String>,
    compose: Option<Vec<String>>,


@@ 99,7 99,10 @@ impl Mailcap {
        Ok(Mailcap { files, data })
    }

    //pub fn lookup(&self) -> Entry {}
    pub fn get(&self, key: &str) -> Option<&Entry> {
        self.data.get(key)
    }

    fn list_potential_files() -> Vec<PathBuf> {
        let mut mailcap_files: Vec<PathBuf> = vec![];
        if let Ok(paths) = env::var("MAILCAPS") {