summaryrefslogtreecommitdiffstats
path: root/imag-bookmark
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2016-07-08 21:42:39 +0200
committerMatthias Beyer <mail@beyermatthias.de>2016-07-14 21:08:46 +0200
commite773294b2ca627321380bae1942472d65f4530a3 (patch)
tree984c3433811ca392dd1b414dde1a4b9f37cdc288 /imag-bookmark
parentf5b046181d44b66b187f1743e1e622a1f0cf9a1e (diff)
Impl add()
Diffstat (limited to 'imag-bookmark')
-rw-r--r--imag-bookmark/src/main.rs18
1 files changed, 17 insertions, 1 deletions
diff --git a/imag-bookmark/src/main.rs b/imag-bookmark/src/main.rs
index 55b0e8fa..b00efd32 100644
--- a/imag-bookmark/src/main.rs
+++ b/imag-bookmark/src/main.rs
@@ -4,11 +4,18 @@ extern crate clap;
extern crate libimagbookmark;
extern crate libimagentrylink;
+extern crate libimagentrytag;
extern crate libimagrt;
+extern crate libimagerror;
extern crate libimagutil;
use libimagentrytag::ui::{get_add_tags, get_remove_tags};
use libimagentrylink::internal::Link;
+use libimagrt::runtime::Runtime;
+use libimagrt::setup::generate_runtime_setup;
+use libimagbookmark::collection::BookmarkCollection;
+use libimagbookmark::link::Link as BookmarkLink;
+use libimagerror::trace::trace_error;
mod ui;
@@ -37,7 +44,16 @@ fn main() {
}
fn add(rt: &Runtime) {
- unimplemented!()
+ let scmd = rt.cli().subcommand_matches("add").unwrap();
+ let coll = scmd.value_of("collection").unwrap(); // enforced by clap
+
+ BookmarkCollection::get(rt.store(), coll)
+ .map(|mut collection| {
+ for url in scmd.values_of("urls").unwrap() { // enforced by clap
+ collection.add_link(BookmarkLink::from(url)).map_err(|e| trace_error(&e));
+ }
+ });
+ info!("Ready");
}
fn collection(rt: &Runtime) {