2016-02-13 19:25:11 +00:00
|
|
|
use libimagrt::runtime::Runtime;
|
2016-07-15 19:56:53 +00:00
|
|
|
use libimagerror::trace::trace_error_exit;
|
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()) {
|
2016-07-15 19:56:53 +00:00
|
|
|
trace_error_exit(&e, 1);
|
2016-02-13 19:25:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
info!("Ok");
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|