imag/imag-counter/src/delete.rs

24 lines
568 B
Rust
Raw Normal View History

2016-02-13 19:25:11 +00:00
use std::process::exit;
use libimagrt::runtime::Runtime;
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");
});
}