From dec6a27900684497d9cb29eaddba6df3994198b7 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Thu, 14 Jul 2016 21:04:11 +0200 Subject: [PATCH] Impl list() --- imag-bookmark/src/main.rs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/imag-bookmark/src/main.rs b/imag-bookmark/src/main.rs index dc24b6f8..2d003463 100644 --- a/imag-bookmark/src/main.rs +++ b/imag-bookmark/src/main.rs @@ -83,7 +83,26 @@ fn collection(rt: &Runtime) { } fn list(rt: &Runtime) { - unimplemented!() + let scmd = rt.cli().subcommand_matches("list").unwrap(); + let coll = scmd.value_of("collection").unwrap(); // enforced by clap + + BookmarkCollection::get(rt.store(), coll) + .map(|collection| { + match collection.links() { + Ok(links) => { + debug!("Listing..."); + for (i, link) in links.iter().enumerate() { + println!("{: >3}: {}", i, link); + }; + debug!("... ready with listing"); + }, + Err(e) => { + trace_error(&e); + exit(1); + }, + } + }); + info!("Ready"); } fn remove(rt: &Runtime) {