diff options
Diffstat (limited to 'bin/core/imag-init/src')
-rw-r--r-- | bin/core/imag-init/src/bin.rs | 4 | ||||
-rw-r--r-- | bin/core/imag-init/src/lib.rs | 24 |
2 files changed, 14 insertions, 14 deletions
diff --git a/bin/core/imag-init/src/bin.rs b/bin/core/imag-init/src/bin.rs index bcb6d974..93cd44f3 100644 --- a/bin/core/imag-init/src/bin.rs +++ b/bin/core/imag-init/src/bin.rs @@ -34,8 +34,8 @@ while_true, )] -extern crate failure; -use failure::Fallible as Result; +extern crate anyhow; +use anyhow::Result; extern crate libimaginitcmd; diff --git a/bin/core/imag-init/src/lib.rs b/bin/core/imag-init/src/lib.rs index c2712956..acb7464d 100644 --- a/bin/core/imag-init/src/lib.rs +++ b/bin/core/imag-init/src/lib.rs @@ -35,7 +35,7 @@ )] extern crate clap; -#[macro_use] extern crate failure; +#[macro_use] extern crate anyhow; #[cfg(test)] extern crate toml; @@ -51,10 +51,10 @@ use std::path::PathBuf; use std::path::Path; use std::process::Command; -use failure::Fallible as Result; -use failure::ResultExt; -use failure::Error; -use failure::err_msg; +use anyhow::Result; +use anyhow::Context; +use anyhow::Error; + use libimagrt::runtime::Runtime; use libimagrt::application::ImagApplication; @@ -120,11 +120,11 @@ pub fn imag_init() -> Result<()> { .map(PathBuf::from) .map(|mut p| { p.push(".imag"); p }) .and_then(|path| if path.exists() { - Err(format_err!("Cannot continue: Path '{}' already exists", path.display())) + Err(anyhow!("Cannot continue: Path '{}' already exists", path.display())) } else { Ok(path) }) - .map_err(|_| err_msg("Failed to retrieve/build path for imag directory."))? + .map_err(|_| anyhow!("Failed to retrieve/build path for imag directory."))? }; { @@ -167,7 +167,7 @@ pub fn imag_init() -> Result<()> { let mut gitignore_path = path.clone(); gitignore_path.push(".gitignore"); gitignore_path.to_str().map(String::from) - }.ok_or_else(|| err_msg("Cannot convert path to string"))?; + }.ok_or_else(|| anyhow!("Cannot convert path to string"))?; OpenOptions::new() .write(true) @@ -181,7 +181,7 @@ pub fn imag_init() -> Result<()> { }) .context("Failed to open new configuration file")?; - let path_str = path.to_str().map(String::from).ok_or_else(|| err_msg("Cannot convert path to string"))?; + let path_str = path.to_str().map(String::from).ok_or_else(|| anyhow!("Cannot convert path to string"))?; let worktree = format!("--work-tree={}", path_str); let gitdir = format!("--git-dir={}/.git", path_str); @@ -197,7 +197,7 @@ pub fn imag_init() -> Result<()> { } else { writeln!(out, "{}", String::from_utf8(output.stderr).expect("No UTF-8 output"))?; if !output.status.success() { - return Err(err_msg("Failed to execute git command")); + return Err(anyhow!("Failed to execute git command")); } } } @@ -214,7 +214,7 @@ pub fn imag_init() -> Result<()> { } else { writeln!(out, "{}", String::from_utf8(output.stderr).expect("No UTF-8 output"))?; if !output.status.success() { - return Err(err_msg("Failed to execute git command")); + return Err(anyhow!("Failed to execute git command")); } } } @@ -230,7 +230,7 @@ pub fn imag_init() -> Result<()> { } else { writeln!(out, "{}", String::from_utf8(output.stderr).expect("No UTF-8 output"))?; if !output.status.success() { - return Err(err_msg("Failed to execute git command")); + return Err(anyhow!("Failed to execute git command")); } } } |