Fix: Delete links to bookmark collection entry before deleting collection
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
parent
49c7c81ff3
commit
5fa6b07b9e
2 changed files with 14 additions and 0 deletions
|
@ -30,6 +30,7 @@ failure = "0.1"
|
||||||
libimagrt = { version = "0.10.0", path = "../../../lib/core/libimagrt" }
|
libimagrt = { version = "0.10.0", path = "../../../lib/core/libimagrt" }
|
||||||
libimagerror = { version = "0.10.0", path = "../../../lib/core/libimagerror" }
|
libimagerror = { version = "0.10.0", path = "../../../lib/core/libimagerror" }
|
||||||
libimagbookmark = { version = "0.10.0", path = "../../../lib/domain/libimagbookmark" }
|
libimagbookmark = { version = "0.10.0", path = "../../../lib/domain/libimagbookmark" }
|
||||||
|
libimagentrylink = { version = "0.10.0", path = "../../../lib/entry/libimagentrylink" }
|
||||||
libimagutil = { version = "0.10.0", path = "../../../lib/etc/libimagutil" }
|
libimagutil = { version = "0.10.0", path = "../../../lib/etc/libimagutil" }
|
||||||
|
|
||||||
[dependencies.clap]
|
[dependencies.clap]
|
||||||
|
|
|
@ -44,6 +44,7 @@ extern crate libimagbookmark;
|
||||||
#[macro_use] extern crate libimagrt;
|
#[macro_use] extern crate libimagrt;
|
||||||
extern crate libimagerror;
|
extern crate libimagerror;
|
||||||
extern crate libimagutil;
|
extern crate libimagutil;
|
||||||
|
extern crate libimagentrylink;
|
||||||
|
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::process::exit;
|
use std::process::exit;
|
||||||
|
@ -60,6 +61,8 @@ use libimagerror::trace::{MapErrTrace, trace_error};
|
||||||
use libimagerror::io::ToExitCode;
|
use libimagerror::io::ToExitCode;
|
||||||
use libimagerror::exit::ExitUnwrap;
|
use libimagerror::exit::ExitUnwrap;
|
||||||
use libimagutil::debug_result::DebugResult;
|
use libimagutil::debug_result::DebugResult;
|
||||||
|
use libimagentrylink::internal::InternalLinker;
|
||||||
|
|
||||||
|
|
||||||
mod ui;
|
mod ui;
|
||||||
|
|
||||||
|
@ -130,6 +133,16 @@ fn collection(rt: &Runtime) {
|
||||||
|
|
||||||
if scmd.is_present("remove") { // remove a collection
|
if scmd.is_present("remove") { // remove a collection
|
||||||
let name = scmd.value_of("remove").unwrap();
|
let name = scmd.value_of("remove").unwrap();
|
||||||
|
|
||||||
|
{ // remove all links
|
||||||
|
let _ = BookmarkCollectionStore::get(rt.store(), &name)
|
||||||
|
.map_err_trace_exit_unwrap()
|
||||||
|
.ok_or_else(|| format_err!("Collection does not exist: {}", name))
|
||||||
|
.map_err_trace_exit_unwrap()
|
||||||
|
.unlink(rt.store())
|
||||||
|
.map_err_trace_exit_unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
if let Ok(_) = BookmarkCollectionStore::delete(rt.store(), &name) {
|
if let Ok(_) = BookmarkCollectionStore::delete(rt.store(), &name) {
|
||||||
info!("Deleted: {}", name);
|
info!("Deleted: {}", name);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue