diff options
Diffstat (limited to 'bin/core/imag-tag')
-rw-r--r-- | bin/core/imag-tag/Cargo.toml | 4 | ||||
-rw-r--r-- | bin/core/imag-tag/src/lib.rs | 20 | ||||
-rw-r--r-- | bin/core/imag-tag/src/ui.rs | 2 |
3 files changed, 13 insertions, 13 deletions
diff --git a/bin/core/imag-tag/Cargo.toml b/bin/core/imag-tag/Cargo.toml index 125ec822..7c0b4a6d 100644 --- a/bin/core/imag-tag/Cargo.toml +++ b/bin/core/imag-tag/Cargo.toml @@ -22,7 +22,7 @@ maintenance = { status = "actively-developed" } [dependencies] log = "0.4.6" toml = "0.5.1" -failure = "0.1.5" +anyhow = "1" resiter = "0.4.0" libimagstore = { version = "0.10.0", path = "../../../lib/core/libimagstore" } @@ -37,7 +37,7 @@ default-features = false features = ["color", "suggestions", "wrap_help"] [dev-dependencies] -toml-query = "0.9.2" +toml-query = { git = "https://github.com/matthiasbeyer/toml-query", branch = "master" } env_logger = "0.7" [dev-dependencies.libimagutil] diff --git a/bin/core/imag-tag/src/lib.rs b/bin/core/imag-tag/src/lib.rs index df09ef54..f562c9a2 100644 --- a/bin/core/imag-tag/src/lib.rs +++ b/bin/core/imag-tag/src/lib.rs @@ -39,7 +39,7 @@ extern crate resiter; #[macro_use] extern crate log; #[cfg(test)] extern crate toml; -#[macro_use] extern crate failure; +#[macro_use] extern crate anyhow; extern crate libimagstore; extern crate libimagrt; @@ -61,8 +61,8 @@ extern crate env_logger; use std::io::Write; -use failure::Fallible as Result; -use failure::err_msg; +use anyhow::Result; + use resiter::AndThen; use resiter::Map; use resiter::FilterMap; @@ -119,7 +119,7 @@ impl ImagApplication for ImagTag { iter.filter_map_ok(|id| { match rt.store().get(id.clone()) { Err(e) => Some(Err(e)), - Ok(None) => Some(Err(format_err!("No entry for id {}", id))), + Ok(None) => Some(Err(anyhow!("No entry for id {}", id))), Ok(Some(entry)) => { let entry_tags = match entry.get_tags() { Err(e) => return Some(Err(e)), @@ -158,7 +158,7 @@ impl ImagApplication for ImagTag { iter.filter_map_ok(|id| { match rt.store().get(id.clone()) { Err(e) => Some(Err(e)), - Ok(None) => Some(Err(format_err!("No entry for id {}", id))), + Ok(None) => Some(Err(anyhow!("No entry for id {}", id))), Ok(Some(entry)) => { let entry_tags = match entry.get_tags() { Err(e) => return Some(Err(e)), @@ -197,7 +197,7 @@ impl ImagApplication for ImagTag { if rt.handle_unknown_subcommand("imag-tag", other, rt.cli())?.success() { Ok(()) } else { - Err(format_err!("Subcommand failed")) + Err(anyhow!("Subcommand failed")) } }, } @@ -261,7 +261,7 @@ fn alter(rt: &Runtime, path: StoreId, add: Option<Vec<Tag>>, rem: Option<Vec<Tag } fn list(path: StoreId, rt: &Runtime, has_subcommand: bool) -> Result<()> { - let entry = rt.store().get(path.clone())?.ok_or_else(|| err_msg("No entry found"))?; + let entry = rt.store().get(path.clone())?.ok_or_else(|| anyhow!("No entry found"))?; let (scmd, json_out, line_out, sepp_out, mut comm_out) = if has_subcommand { let scmd = rt.cli().subcommand_matches("list").unwrap(); let json_out = scmd.is_present("json"); @@ -320,7 +320,7 @@ fn get_remove_tags(matches: &ArgMatches) -> Result<Option<Vec<Tag>>> { fn retrieve_tags(m: &ArgMatches, s: &'static str, v: &'static str) -> Result<Option<Vec<Tag>>> { Ok(Some(m .subcommand_matches(s) - .ok_or_else(|| format_err!("Expected subcommand '{}', but was not specified", s))? + .ok_or_else(|| anyhow!("Expected subcommand '{}', but was not specified", s))? .values_of(v) .unwrap() // enforced by clap .map(String::from) @@ -334,8 +334,8 @@ mod tests { use toml::value::Value; use toml_query::read::TomlValueReadExt; - use failure::Fallible as Result; - use failure::Error; + use anyhow::Result; + use anyhow::Error; use libimagrt::runtime::Runtime; use libimagstore::storeid::StoreId; diff --git a/bin/core/imag-tag/src/ui.rs b/bin/core/imag-tag/src/ui.rs index 48de0c32..83f8cbea 100644 --- a/bin/core/imag-tag/src/ui.rs +++ b/bin/core/imag-tag/src/ui.rs @@ -20,7 +20,7 @@ use std::path::PathBuf; use clap::{Arg, ArgMatches, ArgGroup, App, SubCommand}; -use failure::Fallible as Result; +use anyhow::Result; use libimagstore::storeid::StoreId; use libimagstore::storeid::IntoStoreId; |