pub struct Editor { /* private fields */ }
Expand description
Launches the default editor to 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!");
}
Implementations§
source§impl Editor
impl Editor
sourcepub fn executable<S: AsRef<OsStr>>(&mut self, val: S) -> &mut Self
pub fn executable<S: AsRef<OsStr>>(&mut self, val: S) -> &mut Self
Sets a specific editor executable.
sourcepub fn require_save(&mut self, val: bool) -> &mut Self
pub fn require_save(&mut self, val: bool) -> &mut Self
Enables or disables the save requirement.
sourcepub fn trim_newlines(&mut self, val: bool) -> &mut Self
pub fn trim_newlines(&mut self, val: bool) -> &mut Self
Enables or disables trailing newline stripping.
This is on by default.