pub struct EditorBuilder<'a> { /* private fields */ }
Expand description
A builder for a Command that will open the user’s configured editor. For simple cases you probably can just use EditorBuilder::edit_file. See crate-level documentation for more details and examples.
Implementations§
Source§impl<'a> EditorBuilder<'a>
impl<'a> EditorBuilder<'a>
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new editor command with no sources. You probably want to call environment on the returned value.
Sourcepub fn source(self, source: Option<impl Into<Cow<'a, str>>>) -> Self
pub fn source(self, source: Option<impl Into<Cow<'a, str>>>) -> Self
Add a static string as a source for the command. This is useful for
static defaults, or external sources such as a configuration file.
This accepts an Option
so you can easily build a chain of sources
that may or may not be defined.
Sourcepub fn environment(self) -> Self
pub fn environment(self) -> Self
Add the VISUAL
and EDITOR
environment variables, in that order. The
variables will be evaluated immediately, not during
build.
Sourcepub fn path(self, path: impl Into<Cow<'a, Path>>) -> Self
pub fn path(self, path: impl Into<Cow<'a, Path>>) -> Self
Define the path to be passed as the final argument.
§Multiple Calls
Subsequent calls to this on the same instance will append to the list of paths. The paths will all be included in the final command, in the order this method was called.
Trait Implementations§
Source§impl<'a> Clone for EditorBuilder<'a>
impl<'a> Clone for EditorBuilder<'a>
Source§fn clone(&self) -> EditorBuilder<'a>
fn clone(&self) -> EditorBuilder<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more