Impl add()
This commit is contained in:
parent
f5b046181d
commit
e773294b2c
1 changed files with 17 additions and 1 deletions
|
@ -4,11 +4,18 @@ extern crate clap;
|
||||||
|
|
||||||
extern crate libimagbookmark;
|
extern crate libimagbookmark;
|
||||||
extern crate libimagentrylink;
|
extern crate libimagentrylink;
|
||||||
|
extern crate libimagentrytag;
|
||||||
extern crate libimagrt;
|
extern crate libimagrt;
|
||||||
|
extern crate libimagerror;
|
||||||
extern crate libimagutil;
|
extern crate libimagutil;
|
||||||
|
|
||||||
use libimagentrytag::ui::{get_add_tags, get_remove_tags};
|
use libimagentrytag::ui::{get_add_tags, get_remove_tags};
|
||||||
use libimagentrylink::internal::Link;
|
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;
|
mod ui;
|
||||||
|
|
||||||
|
@ -37,7 +44,16 @@ fn main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add(rt: &Runtime) {
|
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) {
|
fn collection(rt: &Runtime) {
|
||||||
|
|
Loading…
Reference in a new issue