pub struct EditorCallBuilder { /* private fields */ }Implementations§
Source§impl EditorCallBuilder
impl EditorCallBuilder
Sourcepub fn new<P: AsRef<Path>>(file_path: P) -> Result<Self, OpenEditorError>
pub fn new<P: AsRef<Path>>(file_path: P) -> Result<Self, OpenEditorError>
Creates a new EditorCallBuilder with the given file path.
You can optionally set the line and column numbers later using the at_line and at_column methods.
Finally, you can call the call_editor method to open the editor.
The editor to use is determined by the VISUAL and EDITOR environment
variables, in that order.
§Errors
This function will return an error if the default editor cannot be found in the environment variables.
Examples found in repository?
More examples
Sourcepub fn new_with_env_vars<P: AsRef<Path>>(
file_path: P,
env_vars: &[&str],
) -> Result<Self, OpenEditorError>
pub fn new_with_env_vars<P: AsRef<Path>>( file_path: P, env_vars: &[&str], ) -> Result<Self, OpenEditorError>
Similar to EditorCallBuilder::new, but allows specifying the
environment variables to use to find the editor.
Sourcepub fn wait_for_editor(self, value: bool) -> Self
pub fn wait_for_editor(self, value: bool) -> Self
Whether to wait for the editor to close before returning.
Sourcepub fn call_editor(&self) -> Result<(), OpenEditorError>
pub fn call_editor(&self) -> Result<(), OpenEditorError>
Calls the editor with options from the EditorCallBuilder.
§Errors
This function will return an error if the commands fails to execute or if the editor returns a non-zero exit code.