Skip to main content

edit_text

Function edit_text 

Source
pub fn edit_text(
    text: Option<&str>,
    editor: Option<&str>,
    extension: &str,
    require_save: bool,
) -> Result<Option<String>>
Expand description

Open a text editor for the user to edit content.

§Arguments

  • text - Initial text to populate the editor with
  • editor - Editor command to use, or None to use $EDITOR/$VISUAL/vi
  • extension - File extension for the temporary file
  • require_save - If true, return None if user didn’t save

§Returns

The edited text, or None if editing was cancelled.