Rewrite edit_in_tmpfile() for new Runtime::editor() signature

This commit is contained in:
Matthias Beyer 2018-03-23 22:57:07 +01:00
parent ea38f2ffbf
commit 7429754665

View file

@ -72,9 +72,11 @@ impl EditHeader for Entry {
pub fn edit_in_tmpfile(rt: &Runtime, s: &mut String) -> Result<()> { pub fn edit_in_tmpfile(rt: &Runtime, s: &mut String) -> Result<()> {
use libimagutil::edit::edit_in_tmpfile_with_command; use libimagutil::edit::edit_in_tmpfile_with_command;
rt.editor() let editor = rt
.ok_or(EE::from_kind(EditErrorKind::NoEditor)) .editor()
.and_then(|editor| { .chain_err(|| EditErrorKind::NoEditor)?
.ok_or_else(|| EE::from_kind(EditErrorKind::NoEditor))?;
edit_in_tmpfile_with_command(editor, s) edit_in_tmpfile_with_command(editor, s)
.chain_err(|| EditErrorKind::IOError) .chain_err(|| EditErrorKind::IOError)
.and_then(|worked| { .and_then(|worked| {
@ -84,6 +86,5 @@ pub fn edit_in_tmpfile(rt: &Runtime, s: &mut String) -> Result<()> {
Ok(()) Ok(())
} }
}) })
})
} }