From 2e9dc4730f5f3eeac17471606037600e55244c6e Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Wed, 18 May 2016 19:06:05 +0200 Subject: [PATCH] imag-view: Remove setup code and use helper --- imag-view/src/main.rs | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/imag-view/src/main.rs b/imag-view/src/main.rs index 81d2b5e9..2fa7802b 100644 --- a/imag-view/src/main.rs +++ b/imag-view/src/main.rs @@ -28,6 +28,7 @@ use std::result::Result as RResult; use std::process::exit; use libimagrt::runtime::Runtime; +use libimagrt::setup::generate_runtime_setup; use libimagstore::store::FileLockEntry; use libimagerror::trace::trace_error; @@ -44,20 +45,10 @@ use viewer::stdout::StdoutViewer; type Result = RResult; fn main() { - let name = "imag-view"; - let version = &version!()[..]; - let about = "View entries (readonly)"; - 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); // we can afford not-executing destructors here - } - }; + let rt = generate_runtime_setup( "imag-view", + &version!()[..], + "View entries (readonly)", + build_ui); let entry_id = rt.cli().value_of("id").unwrap(); // enforced by clap