imag/src/module/bm/mod.rs

55 lines
1 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;
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 Module for BMModule {
fn new(rt : &Runtime) -> BMModule {
BMModule {
path: None
}
}
fn callnames() -> &'static [&'static str] {
CALLNAMES
}
fn name(&self) -> &'static str{
"Bookmark"
}
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
}