Use generate_runtime_setup() to create Runtime object
This commit is contained in:
parent
19e9dfe33c
commit
ee6e766c8d
1 changed files with 5 additions and 20 deletions
|
@ -47,12 +47,7 @@ extern crate libimagstore;
|
||||||
extern crate libimagtimeui;
|
extern crate libimagtimeui;
|
||||||
extern crate libimagutil;
|
extern crate libimagutil;
|
||||||
|
|
||||||
use std::io::Write;
|
use libimagrt::setup::generate_runtime_setup;
|
||||||
use std::process::exit;
|
|
||||||
|
|
||||||
use libimagerror::exit::ExitUnwrap;
|
|
||||||
use libimagerror::io::ToExitCode;
|
|
||||||
use libimagrt::runtime::Runtime;
|
|
||||||
|
|
||||||
mod create;
|
mod create;
|
||||||
mod delete;
|
mod delete;
|
||||||
|
@ -66,24 +61,14 @@ use create::create;
|
||||||
use delete::delete;
|
use delete::delete;
|
||||||
use edit::edit;
|
use edit::edit;
|
||||||
use list::list;
|
use list::list;
|
||||||
use ui::build_ui;
|
|
||||||
use view::view;
|
use view::view;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let version = make_imag_version!();
|
let version = make_imag_version!();
|
||||||
let name = "imag-diary";
|
let rt = generate_runtime_setup("imag-diary",
|
||||||
let about = "Personal Diary/Diaries";
|
&version,
|
||||||
let ui = build_ui(Runtime::get_default_cli_builder(name, &version, about));
|
"Personal Diary/Diaries",
|
||||||
let rt = {
|
ui::build_ui);
|
||||||
let rt = Runtime::new(ui);
|
|
||||||
if rt.is_ok() {
|
|
||||||
rt.unwrap()
|
|
||||||
} else {
|
|
||||||
let _ = writeln!(rt.stdout(), "Could not set up Runtime").to_exit_code().unwrap_or_exit();
|
|
||||||
let _ = writeln!(rt.stdout(), "{:?}", rt.err().unwrap()).to_exit_code().unwrap_or_exit();
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
rt.cli()
|
rt.cli()
|
||||||
.subcommand_name()
|
.subcommand_name()
|
||||||
|
|
Loading…
Reference in a new issue