Impl remove()
This commit is contained in:
parent
8eeb8bb310
commit
5bfdd5a827
2 changed files with 21 additions and 1 deletions
|
@ -21,6 +21,9 @@ path = "../libimagref"
|
|||
[dependencies.libimagerror]
|
||||
path = "../libimagerror"
|
||||
|
||||
[dependencies.libimaginteraction]
|
||||
path = "../libimaginteraction"
|
||||
|
||||
[dependencies.libimagentrylist]
|
||||
path = "../libimagentrylist"
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ extern crate libimagrt;
|
|||
extern crate libimagref;
|
||||
extern crate libimagerror;
|
||||
extern crate libimagentrylist;
|
||||
extern crate libimaginteraction;
|
||||
|
||||
mod ui;
|
||||
use ui::build_ui;
|
||||
|
@ -61,7 +62,23 @@ fn add(rt: &Runtime) {
|
|||
}
|
||||
|
||||
fn remove(rt: &Runtime) {
|
||||
unimplemented!()
|
||||
use libimagref::error::RefErrorKind;
|
||||
use libimagerror::into::IntoError;
|
||||
use libimaginteraction::ask::ask_bool;
|
||||
|
||||
let cmd = rt.cli().subcommand_matches("remove").unwrap();
|
||||
let hash = cmd.value_of("hash").map(String::from).unwrap(); // saved by clap
|
||||
let yes = cmd.is_present("yes");
|
||||
|
||||
if yes || ask_bool(&format!("Delete Ref with hash '{}'", hash)[..], None) {
|
||||
match Ref::delete_by_hash(rt.store(), hash) {
|
||||
Err(e) => trace_error(&e),
|
||||
Ok(_) => info!("Ok"),
|
||||
}
|
||||
} else {
|
||||
info!("Aborted");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fn list(rt: &Runtime) {
|
||||
|
|
Loading…
Reference in a new issue