summaryrefslogtreecommitdiffstats
path: root/imag-bookmark
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2016-07-14 20:54:53 +0200
committerMatthias Beyer <mail@beyermatthias.de>2016-07-14 21:08:46 +0200
commit803806ea77374c8ce1b6c7579d20a5f46dd4688e (patch)
tree92c6c405b271efc6ff49910af895b7ddefbed817 /imag-bookmark
parentde4c700d6e380128479ed434470f72a2880d7bc9 (diff)
Impl collection()
Diffstat (limited to 'imag-bookmark')
-rw-r--r--imag-bookmark/src/main.rs24
1 files changed, 23 insertions, 1 deletions
diff --git a/imag-bookmark/src/main.rs b/imag-bookmark/src/main.rs
index 758c52d5..dc24b6f8 100644
--- a/imag-bookmark/src/main.rs
+++ b/imag-bookmark/src/main.rs
@@ -9,6 +9,8 @@ extern crate libimagrt;
extern crate libimagerror;
extern crate libimagutil;
+use std::process::exit;
+
use libimagentrytag::ui::{get_add_tags, get_remove_tags};
use libimagentrylink::internal::Link;
use libimagrt::runtime::Runtime;
@@ -57,7 +59,27 @@ fn add(rt: &Runtime) {
}
fn collection(rt: &Runtime) {
- unimplemented!()
+ let scmd = rt.cli().subcommand_matches("collection").unwrap();
+
+ if scmd.is_present("add") { // adding a new collection
+ let name = scmd.value_of("add").unwrap();
+ if let Ok(_) = BookmarkCollection::new(rt.store(), name) {
+ info!("Created: {}", name);
+ } else {
+ warn!("Creating collection {} failed", name);
+ exit(1);
+ }
+ }
+
+ if scmd.is_present("remove") { // remove a collection
+ let name = scmd.value_of("remove").unwrap();
+ if let Ok(_) = BookmarkCollection::delete(rt.store(), name) {
+ info!("Deleted: {}", name);
+ } else {
+ warn!("Deleting collection {} failed", name);
+ exit(1);
+ }
+ }
}
fn list(rt: &Runtime) {