Struct clt::Editor [] [src]

pub struct Editor {
    // some fields omitted
}

One editor for you to edit the given text or file.

Methods

impl Editor
[src]

fn new(editor: &'static str) -> Editor

Create one new editor.

fn env(&mut self, key: &'static str, value: &'static str)

Inserts or updates an environment variable mapping.

fn edit_file(&self, filename: &str)

Edit a file. Examples:

use clt::Editor;

let editor = Editor::new("vim");
editor.edit_file("/path/to/myfile.py");

fn edit(&self, text: String, extension: &str) -> String

Edit some text. Examples:

use clt::Editor;

let editor = Editor::new("vim");
let mut text = String::new();
text.push_str("hello");
let edited = editor.edit(text, ".txt");