diff --git a/bin/core/imag-store/src/retrieve.rs b/bin/core/imag-store/src/retrieve.rs index 19c85b16..5c664f93 100644 --- a/bin/core/imag-store/src/retrieve.rs +++ b/bin/core/imag-store/src/retrieve.rs @@ -31,21 +31,19 @@ pub fn retrieve(rt: &Runtime) { rt.cli() .subcommand_matches("retrieve") .map(|scmd| { - scmd.value_of("id") - .map(|id| { - let path = PathBuf::from(id); - let path = try!(StoreId::new(Some(rt.store().path().clone()), path) - .map_err_trace_exit(1)); - debug!("path = {:?}", path); + // unwrap() is safe as arg is required + let id = scmd.value_of("id").unwrap(); + let path = PathBuf::from(id); + let store = Some(rt.store().path().clone()); + let path = try!(StoreId::new(store, path).map_err_trace_exit(1)); + debug!("path = {:?}", path); - rt.store() - // "id" must be present, enforced via clap spec - .retrieve(path) - .map(|e| print_entry(rt, scmd, e)) - .map_dbg_str("No entry") - .map_dbg(|e| format!("{:?}", e)) - .map_err_trace() - }) + rt.store() + .retrieve(path) + .map(|e| print_entry(rt, scmd, e)) + .map_dbg_str("No entry") + .map_dbg(|e| format!("{:?}", e)) + .map_err_trace() }); } diff --git a/bin/core/imag-store/src/ui.rs b/bin/core/imag-store/src/ui.rs index b8620c46..ff014f25 100644 --- a/bin/core/imag-store/src/ui.rs +++ b/bin/core/imag-store/src/ui.rs @@ -69,8 +69,7 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { .about("Retrieve an entry from the store (implicitely creates the entry)") .version("0.1") .arg(Arg::with_name("id") - .long("id") - .short("i") + .index(1) .takes_value(true) .required(true) .help("Retreive by Store Path, where root (/) is the store itself"))