diff --git a/src/module/bm/commands/mod.rs b/src/module/bm/commands/mod.rs new file mode 100644 index 00000000..9016b847 --- /dev/null +++ b/src/module/bm/commands/mod.rs @@ -0,0 +1,92 @@ +mod add { + use clap::ArgMatches; + + use module::command::{CommandError, CommandResult, CommandEnv, ExecutableCommand}; + use runtime::Runtime; + use storage::backend::{StorageBackend, StorageBackendError}; + + pub struct AddCommand; + + pub impl AddCommand { + + fn new() -> AddCommand { + AddCommand + } + + } + + pub impl ExecutableCommand for AddCommand { + + fn get_callname() -> &'static str { + "add" + } + + fn exec<'a>(&self, env: CommandEnv<'a>) -> CommandResult + { + } + + } + +} + +mod list { + use clap::ArgMatches; + + use module::command::{CommandError, CommandResult, CommandEnv, ExecutableCommand}; + use runtime::Runtime; + use storage::backend::{StorageBackend, StorageBackendError}; + + pub struct ListCommand; + + pub impl ListCommand { + + fn new() -> ListCommand { + ListCommand + } + + } + + pub impl ExecutableCommand for ListCommand { + + fn get_callname() -> &'static str { + "list" + } + + fn exec<'a>(&self, env: CommandEnv<'a>) -> CommandResult + { + } + + } + +} + +mod remove { + use clap::ArgMatches; + + use module::command::{CommandError, CommandResult, CommandEnv, ExecutableCommand}; + use runtime::Runtime; + use storage::backend::{StorageBackend, StorageBackendError}; + + pub struct RemoveCommand; + + pub impl RemoveCommand { + + fn new() -> RemoveCommand { + RemoveCommand + } + + } + + pub impl ExecutableCommand for RemoveCommand { + + fn get_callname() -> &'static str { + "remove" + } + + fn exec<'a>(&self, env: CommandEnv<'a>) -> CommandResult + { + } + + } + +} diff --git a/src/module/bm/mod.rs b/src/module/bm/mod.rs index 9eedee65..4c74cc81 100644 --- a/src/module/bm/mod.rs +++ b/src/module/bm/mod.rs @@ -8,10 +8,16 @@ use clap::ArgMatches; use regex::Regex; mod header; +mod commands; use self::header::build_header; use storage::json::parser::JsonHeaderParser; use storage::parser::FileHeaderParser; +use module::command::ExecutableCommand; + +use self::commands::add::*; +use self::commands::list::*; +use self::commands::remove::*; pub struct BMModule { path: Option, @@ -60,6 +66,14 @@ impl Module for BMModule { fn shutdown(&self, rt : &Runtime) -> ModuleResult { Ok(()) } + + fn get_commands(&self, rt: &Runtime) -> Vec { + vec![ + AddCommand::new(), + ListCommand::new(), + RemoveCommand::new(), + ] + } } fn add<'a>(rt: &Runtime, sub: &ArgMatches<'a, 'a>) -> ModuleResult {