Function open_editor

Source
pub fn open_editor() -> Result<String, OpenEditorError>
Expand description

Open the default editor and returns what was written in it.

The default editor is determined by the VISUAL and EDITOR environment variables, in that order.

ยงErrors

If the editor call fails, or if the file cannot be read, an error will be returned.

Examples found in repository?
examples/get_user_input.rs (line 4)
3fn main() -> Result<(), OpenEditorError> {
4    let user_input = open_editor()?;
5    println!("User input:\n{user_input}");
6    Ok(())
7}