From 3f19aba7b28bc6eb493133d41c9e4e89a5c6d701 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 28 Nov 2015 11:36:06 +0100 Subject: [PATCH] Add subcommand calling code in main() --- src/main.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index a03cd737..3ce6ea03 100644 --- a/src/main.rs +++ b/src/main.rs @@ -40,7 +40,17 @@ fn main() { if let Some(matches) = rt.config.cli_matches.subcommand_matches("bm") { let module : BMModule = Module::new(&rt); - //module.execute(&rt); + let commands = module.get_commands(&rt); + if let Some(command) = matches.subcommand_name() { + debug!("Subcommand: {}", command); + match commands.get(command) { + Some(f) => f(&rt), + None => debug!("No command '{}' found", command), + } + } else { + debug!("No subcommand"); + } + module.shutdown(&rt); } else { // Err(ModuleError::mk("No commandline call"))