imag-contact: Replace read with typed read
This commit is contained in:
parent
137680498c
commit
f0e8e89c15
1 changed files with 5 additions and 13 deletions
|
@ -56,8 +56,7 @@ use std::path::PathBuf;
|
||||||
use handlebars::Handlebars;
|
use handlebars::Handlebars;
|
||||||
use clap::ArgMatches;
|
use clap::ArgMatches;
|
||||||
use vobject::vcard::Vcard;
|
use vobject::vcard::Vcard;
|
||||||
use toml_query::read::TomlValueReadExt;
|
use toml_query::read::TomlValueReadTypeExt;
|
||||||
use toml::Value;
|
|
||||||
use walkdir::WalkDir;
|
use walkdir::WalkDir;
|
||||||
|
|
||||||
use libimagrt::runtime::Runtime;
|
use libimagrt::runtime::Runtime;
|
||||||
|
@ -219,18 +218,11 @@ fn get_contact_print_format(config_value_path: &'static str, rt: &Runtime, scmd:
|
||||||
.unwrap_or_else(|| {
|
.unwrap_or_else(|| {
|
||||||
rt.config()
|
rt.config()
|
||||||
.ok_or_else(|| CE::from("No configuration file".to_owned()))
|
.ok_or_else(|| CE::from("No configuration file".to_owned()))
|
||||||
.map_err_trace_exit(1)
|
.map_err_trace_exit_unwrap(1)
|
||||||
.unwrap()
|
.read_string(config_value_path)
|
||||||
.read(config_value_path)
|
.map_err_trace_exit_unwrap(1)
|
||||||
.map_err_trace_exit(1)
|
|
||||||
.unwrap()
|
|
||||||
.ok_or_else(|| CE::from("Configuration 'contact.list_format' does not exist".to_owned()))
|
.ok_or_else(|| CE::from("Configuration 'contact.list_format' does not exist".to_owned()))
|
||||||
.and_then(|value| match *value {
|
.map_err_trace_exit_unwrap(1)
|
||||||
Value::String(ref s) => Ok(s.clone()),
|
|
||||||
_ => Err(CE::from("Type error: Expected String at 'contact.list_format'. Have non-String".to_owned()))
|
|
||||||
})
|
|
||||||
.map_err_trace_exit(1)
|
|
||||||
.unwrap()
|
|
||||||
});
|
});
|
||||||
|
|
||||||
let mut hb = Handlebars::new();
|
let mut hb = Handlebars::new();
|
||||||
|
|
Loading…
Reference in a new issue