From c432e8c2c405dba633db5cfe98be33fd05d66188 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 27 Dec 2015 18:22:24 +0100 Subject: [PATCH] Add subcommand calling code --- src/module/bm/mod.rs | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/module/bm/mod.rs b/src/module/bm/mod.rs index a390020d..3e0b5b09 100644 --- a/src/module/bm/mod.rs +++ b/src/module/bm/mod.rs @@ -22,12 +22,33 @@ impl<'a> BM<'a> { &self.rt } + fn command_add(&self) -> bool { + unimplemented!() + } + + fn command_list(&self) -> bool { + unimplemented!() + } + + fn command_remove(&self) -> bool { + unimplemented!() + } + + } impl<'a> Module<'a> for BM<'a> { fn exec(&self, matches: &ArgMatches) -> bool { - unimplemented!() + match matches.subcommand_name() { + Some("add") => self.command_add(), + Some("list") => self.command_list(), + Some("remove") => self.command_remove(), + Some(_) | None => { + info!("No command given, doing nothing"); + false + }, + } } fn name(&self) -> &'static str { @@ -43,3 +64,4 @@ impl<'a> Debug for BM<'a> { } } +