Refactor edit_in_tmpfile()
To offer variant where we can pass the editor as command.
This commit is contained in:
parent
21714660df
commit
501d1f38a2
1 changed files with 5 additions and 0 deletions
|
@ -39,6 +39,10 @@ impl<'a> Edit for FileLockEntry<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn edit_in_tmpfile(rt: &Runtime, s: &mut String) -> Result<()> {
|
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 tempfile::NamedTempFile;
|
||||||
use std::io::Seek;
|
use std::io::Seek;
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
|
@ -75,3 +79,4 @@ pub fn edit_in_tmpfile(rt: &Runtime, s: &mut String) -> Result<()> {
|
||||||
Err(EditErrorKind::InstantiateError.into())
|
Err(EditErrorKind::InstantiateError.into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue