From 9c374528d9c5c20ef4f9bdaf7d50e0f5da07a563 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Wed, 18 May 2016 19:06:05 +0200 Subject: [PATCH] imag-tag: Remove setup code and use helper --- imag-tag/src/main.rs | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/imag-tag/src/main.rs b/imag-tag/src/main.rs index f737d6e0..d653686f 100644 --- a/imag-tag/src/main.rs +++ b/imag-tag/src/main.rs @@ -12,6 +12,7 @@ extern crate libimagerror; use std::process::exit; use libimagrt::runtime::Runtime; +use libimagrt::setup::generate_runtime_setup; use libimagentrytag::tagable::Tagable; use libimagstore::storeid::build_entry_path; use libimagerror::trace::trace_error; @@ -21,20 +22,10 @@ mod ui; use ui::build_ui; fn main() { - let name = "imag-store"; - let version = &version!()[..]; - let about = "Direct interface to the store. Use with great care!"; - let ui = build_ui(Runtime::get_default_cli_builder(name, version, about)); - let rt = { - let rt = Runtime::new(ui); - if rt.is_ok() { - rt.unwrap() - } else { - println!("Could not set up Runtime"); - println!("{:?}", rt.unwrap_err()); - exit(1); - } - }; + let rt = generate_runtime_setup("imag-store", + &version!()[..], + "Direct interface to the store. Use with great care!", + build_ui); let id = rt.cli().value_of("id").unwrap(); // enforced by clap rt.cli()