imag/src/module/bm/mod.rs

70 lines
1.3 KiB
Rust
Raw Normal View History

2015-10-25 18:56:04 +00:00
use runtime::Runtime;
use module::Module;
use module::CommandMap;
2015-10-25 18:56:04 +00:00
use module::ModuleResult;
use module::ModuleError;
use std::path::Path;
use std::result::Result;
2015-11-30 17:33:30 +00:00
use std::fmt::Result as FMTResult;
use std::fmt::Formatter;
use std::fmt::Debug;
2015-10-25 18:56:04 +00:00
use clap::ArgMatches;
use regex::Regex;
2015-10-30 17:26:04 +00:00
mod header;
2015-11-24 19:15:41 +00:00
mod commands;
2015-10-30 17:26:04 +00:00
2015-11-10 16:38:02 +00:00
use self::header::build_header;
use storage::json::parser::JsonHeaderParser;
use storage::parser::FileHeaderParser;
2015-11-24 19:15:41 +00:00
use self::commands::*;
2015-11-10 16:38:02 +00:00
2015-10-25 18:56:04 +00:00
pub struct BMModule {
path: Option<String>,
}
const CALLNAMES : &'static [&'static str] = &[ "bm", "bookmark" ];
impl BMModule {
2015-10-25 18:56:04 +00:00
pub fn new(rt : &Runtime) -> BMModule {
2015-10-25 18:56:04 +00:00
BMModule {
path: None
}
}
}
impl Module for BMModule {
fn callnames(&self) -> &'static [&'static str] {
2015-10-25 18:56:04 +00:00
CALLNAMES
}
fn name(&self) -> &'static str{
2015-11-28 12:07:30 +00:00
"bookmark"
2015-10-25 18:56:04 +00:00
}
fn shutdown(&self, rt : &Runtime) -> ModuleResult {
Ok(())
}
2015-11-24 19:15:41 +00:00
fn get_commands(&self, rt: &Runtime) -> CommandMap {
let mut hm = CommandMap::new();
hm.insert("add", add_command);
hm.insert("list", list_command);
hm.insert("remove", remove_command);
hm
2015-11-24 19:15:41 +00:00
}
2015-10-25 18:56:04 +00:00
}
2015-11-30 17:33:30 +00:00
impl Debug for BMModule {
fn fmt(&self, fmt: &mut Formatter) -> FMTResult {
write!(fmt, "[Module][BM]");
Ok(())
}
}