Add subcommand calling code in main()
This commit is contained in:
parent
4a73a317d4
commit
3f19aba7b2
1 changed files with 11 additions and 1 deletions
12
src/main.rs
12
src/main.rs
|
@ -40,7 +40,17 @@ fn main() {
|
||||||
|
|
||||||
if let Some(matches) = rt.config.cli_matches.subcommand_matches("bm") {
|
if let Some(matches) = rt.config.cli_matches.subcommand_matches("bm") {
|
||||||
let module : BMModule = Module::new(&rt);
|
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);
|
module.shutdown(&rt);
|
||||||
} else {
|
} else {
|
||||||
// Err(ModuleError::mk("No commandline call"))
|
// Err(ModuleError::mk("No commandline call"))
|
||||||
|
|
Loading…
Reference in a new issue