imag: Move from error-chain to failure
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
parent
f4ff2ba250
commit
79b996f0ad
2 changed files with 6 additions and 15 deletions
|
@ -32,7 +32,6 @@ walkdir = "2"
|
||||||
log = "0.4.0"
|
log = "0.4.0"
|
||||||
toml = "0.4"
|
toml = "0.4"
|
||||||
toml-query = "0.7"
|
toml-query = "0.7"
|
||||||
is-match = "0.1"
|
|
||||||
|
|
||||||
libimagrt = { version = "0.9.0", path = "../../../lib/core/libimagrt" }
|
libimagrt = { version = "0.9.0", path = "../../../lib/core/libimagrt" }
|
||||||
libimagerror = { version = "0.9.0", path = "../../../lib/core/libimagerror" }
|
libimagerror = { version = "0.9.0", path = "../../../lib/core/libimagerror" }
|
||||||
|
|
|
@ -37,7 +37,6 @@ extern crate clap;
|
||||||
extern crate walkdir;
|
extern crate walkdir;
|
||||||
extern crate toml;
|
extern crate toml;
|
||||||
extern crate toml_query;
|
extern crate toml_query;
|
||||||
#[macro_use] extern crate is_match;
|
|
||||||
|
|
||||||
#[macro_use] extern crate libimagrt;
|
#[macro_use] extern crate libimagrt;
|
||||||
extern crate libimagerror;
|
extern crate libimagerror;
|
||||||
|
@ -56,7 +55,6 @@ use clap::{Arg, ArgMatches, AppSettings, SubCommand};
|
||||||
use toml::Value;
|
use toml::Value;
|
||||||
use toml_query::read::TomlValueReadExt;
|
use toml_query::read::TomlValueReadExt;
|
||||||
|
|
||||||
use libimagrt::error::RuntimeErrorKind;
|
|
||||||
use libimagrt::runtime::Runtime;
|
use libimagrt::runtime::Runtime;
|
||||||
use libimagrt::spec::CliSpec;
|
use libimagrt::spec::CliSpec;
|
||||||
use libimagerror::io::ToExitCode;
|
use libimagerror::io::ToExitCode;
|
||||||
|
@ -91,7 +89,7 @@ fn help_text(cmds: Vec<String>) -> String {
|
||||||
Call a command with 'imag <command> <args>'
|
Call a command with 'imag <command> <args>'
|
||||||
Each command can be called with "--help" to get the respective helptext.
|
Each command can be called with "--help" to get the respective helptext.
|
||||||
|
|
||||||
Please visit https://git.imag-pim.org/imag to view the source code,
|
Please visit https://github.com/matthiasbeyer/imag to view the source code,
|
||||||
follow the development of imag or maybe even contribute to imag.
|
follow the development of imag or maybe even contribute to imag.
|
||||||
|
|
||||||
imag is free software. It is released under the terms of LGPLv2.1
|
imag is free software. It is released under the terms of LGPLv2.1
|
||||||
|
@ -190,17 +188,11 @@ fn main() {
|
||||||
.value_of(Runtime::arg_config_name())
|
.value_of(Runtime::arg_config_name())
|
||||||
.map_or_else(|| rtp.clone(), PathBuf::from);
|
.map_or_else(|| rtp.clone(), PathBuf::from);
|
||||||
debug!("Config path = {:?}", configpath);
|
debug!("Config path = {:?}", configpath);
|
||||||
let config = match ::libimagrt::configuration::fetch_config(&configpath) {
|
let config = ::libimagrt::configuration::fetch_config(&configpath)
|
||||||
Ok(c) => Some(c),
|
.unwrap_or_else(|e| {
|
||||||
Err(e) => if !is_match!(e.kind(), &RuntimeErrorKind::ConfigNoConfigFileFound) {
|
trace_error(&e);
|
||||||
trace_error(&e);
|
exit(1)
|
||||||
::std::process::exit(1)
|
});
|
||||||
} else {
|
|
||||||
println!("No config file found.");
|
|
||||||
println!("Continuing without configuration file");
|
|
||||||
None
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
debug!("matches: {:?}", matches);
|
debug!("matches: {:?}", matches);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue