Add CommandEnv building in command calling code in main()

This commit is contained in:
Matthias Beyer 2015-11-28 11:55:40 +01:00
parent 0a026002b0
commit fda2c4feea

View file

@ -13,6 +13,7 @@ use runtime::{ImagLogger, Runtime};
use clap::App; use clap::App;
use module::Module; use module::Module;
use module::ModuleError; use module::ModuleError;
use module::CommandEnv;
use module::bm::BMModule; use module::bm::BMModule;
use storage::backend::StorageBackend; use storage::backend::StorageBackend;
@ -47,10 +48,18 @@ fn main() {
let backend = StorageBackend::new(rt.get_rtp()); let backend = StorageBackend::new(rt.get_rtp());
match commands.get(command) { let cmdenv = CommandEnv {
Some(f) => f(&rt, &backend), rt: &rt,
None => debug!("No command '{}' found", command), bk: &backend,
} matches: matches,
};
let result = match commands.get(command) {
Some(f) => f(cmdenv),
None => Err(ModuleError::new("No subcommand found")),
};
debug!("Result of command: {:?}", result);
} else { } else {
debug!("No subcommand"); debug!("No subcommand");
} }