Struct dialoguer::Editor
[−]
[src]
pub struct Editor { /* fields omitted */ }
Launches the default editor edit a string.
Example:
use dialoguer::Editor; if let Some(rv) = Editor::new().edit("Enter a commit message").unwrap() { println!("Your message:"); println!("{}", rv); } else { println!("Abort!"); }
Methods
impl Editor
[src]
fn new() -> Editor
Creates a new editor.
fn executable<S: AsRef<OsStr>>(&mut self, val: S) -> &mut Editor
Sets a specific editor executable.
fn extension(&mut self, val: &str) -> &mut Editor
Sets a specific extension
fn require_save(&mut self, val: bool) -> &mut Editor
Enables or disables the save requirement.
fn trim_newlines(&mut self, val: bool) -> &mut Editor
Enables or disables trailing newline stripping.
This is on by default.
fn edit(&self, s: &str) -> Result<Option<String>>
Launches the editor to edit a string.
Returns None
if the file was not saved or otherwise the
entered text.