From 501d1f38a2099efcb9580ede596fdb74cb9f23a4 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Thu, 8 Sep 2016 17:37:10 +0200 Subject: [PATCH] Refactor edit_in_tmpfile() To offer variant where we can pass the editor as command. --- libimagentryedit/src/edit.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libimagentryedit/src/edit.rs b/libimagentryedit/src/edit.rs index cdf976a4..cc9bbc64 100644 --- a/libimagentryedit/src/edit.rs +++ b/libimagentryedit/src/edit.rs @@ -39,6 +39,10 @@ impl<'a> Edit for FileLockEntry<'a> { } pub fn edit_in_tmpfile(rt: &Runtime, s: &mut String) -> Result<()> { + edit_in_tmpfile_with_command(rt.editor(), s) +} + +pub fn edit_in_tmpfile_with_command(cmd: Command, s: &mut String) -> Result<()> { use tempfile::NamedTempFile; use std::io::Seek; use std::io::Read; @@ -75,3 +79,4 @@ pub fn edit_in_tmpfile(rt: &Runtime, s: &mut String) -> Result<()> { Err(EditErrorKind::InstantiateError.into()) } } +