diff options
Diffstat (limited to 'bin/core/imag-git')
-rw-r--r-- | bin/core/imag-git/Cargo.toml | 4 | ||||
-rw-r--r-- | bin/core/imag-git/src/lib.rs | 24 |
2 files changed, 14 insertions, 14 deletions
diff --git a/bin/core/imag-git/Cargo.toml b/bin/core/imag-git/Cargo.toml index 168e04ce..fb0c04de 100644 --- a/bin/core/imag-git/Cargo.toml +++ b/bin/core/imag-git/Cargo.toml @@ -22,8 +22,8 @@ maintenance = { status = "actively-developed" } [dependencies] log = "0.4.6" toml = "0.5.1" -toml-query = "0.9.2" -failure = "0.1.5" +toml-query = { git = "https://github.com/matthiasbeyer/toml-query", branch = "master" } +anyhow = "1" libimagrt = { version = "0.10.0", path = "../../../lib/core/libimagrt" } libimagerror = { version = "0.10.0", path = "../../../lib/core/libimagerror" } diff --git a/bin/core/imag-git/src/lib.rs b/bin/core/imag-git/src/lib.rs index d839f986..94003d91 100644 --- a/bin/core/imag-git/src/lib.rs +++ b/bin/core/imag-git/src/lib.rs @@ -38,7 +38,7 @@ extern crate clap; #[macro_use] extern crate log; extern crate toml; extern crate toml_query; -#[macro_use] extern crate failure; +#[macro_use] extern crate anyhow; extern crate libimagrt; extern crate libimagerror; @@ -49,9 +49,9 @@ use std::process::Command; use toml::Value; use toml_query::read::TomlValueReadExt; use clap::App; -use failure::Fallible as Result; -use failure::ResultExt; -use failure::err_msg; +use anyhow::Result; +use anyhow::Context; + use libimagrt::runtime::Runtime; use libimagrt::application::ImagApplication; @@ -67,18 +67,18 @@ impl ImagApplication for ImagGit { fn run(rt: Runtime) -> Result<()> { let execute_in_store = rt .config() - .ok_or_else(|| err_msg("No configuration. Please use git yourself, not via imag-git")) + .ok_or_else(|| anyhow!("No configuration. Please use git yourself, not via imag-git")) .context("Won't continue without configuration.") ? .read("git.execute_in_store") .context("Failed to read config setting 'git.execute_in_store'") ? - .ok_or_else(|| err_msg("Missing config setting 'git.execute_in_store'")) + .ok_or_else(|| anyhow!("Missing config setting 'git.execute_in_store'")) ?; let execute_in_store = match *execute_in_store { Value::Boolean(b) => Ok(b), - _ => Err(err_msg("Type error: 'git.execute_in_store' is not a boolean!")), + _ => Err(anyhow!("Type error: 'git.execute_in_store' is not a boolean!")), }?; let execpath = if execute_in_store { @@ -87,7 +87,7 @@ impl ImagApplication for ImagGit { rt.rtp().to_str() } .map(String::from) - .ok_or_else(|| format_err!("Cannot parse to string: {:?}", rt.store().path()))?; + .ok_or_else(|| anyhow!("Cannot parse to string: {:?}", rt.store().path()))?; let mut command = Command::new("git"); command @@ -122,7 +122,7 @@ impl ImagApplication for ImagGit { Ok(exit_status) => { if !exit_status.success() { debug!("git exited with non-zero exit code: {:?}", exit_status); - Err(format_err!("git exited with non-zero exit code: {:?}", exit_status)) + Err(anyhow!("git exited with non-zero exit code: {:?}", exit_status)) } else { debug!("Successful exit!"); Ok(()) @@ -132,9 +132,9 @@ impl ImagApplication for ImagGit { Err(e) => { debug!("Error calling git"); Err(match e.kind() { - ErrorKind::NotFound => err_msg("Cannot find 'git' executable"), - ErrorKind::PermissionDenied => err_msg("No permission to execute: 'git'"), - _ => format_err!("Error spawning: {:?}", e), + ErrorKind::NotFound => anyhow!("Cannot find 'git' executable"), + ErrorKind::PermissionDenied => anyhow!("No permission to execute: 'git'"), + _ => anyhow!("Error spawning: {:?}", e), }) } } |