2016-02-13 19:25:11 +00:00
|
|
|
use std::process::exit;
|
|
|
|
|
|
|
|
use libimagrt::runtime::Runtime;
|
2016-05-16 16:59:02 +00:00
|
|
|
use libimagerror::trace::trace_error;
|
2016-02-13 19:25:11 +00:00
|
|
|
use libimagcounter::counter::Counter;
|
|
|
|
|
|
|
|
pub fn delete(rt: &Runtime) {
|
|
|
|
rt.cli()
|
|
|
|
.subcommand_matches("delete")
|
|
|
|
.map(|scmd| {
|
|
|
|
debug!("Found 'delete' subcommand...");
|
|
|
|
|
|
|
|
let name = String::from(scmd.value_of("name").unwrap()); // safe because clap enforces
|
|
|
|
|
|
|
|
if let Err(e) = Counter::delete(name, rt.store()) {
|
|
|
|
trace_error(&e);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
info!("Ok");
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|