Rust library that opens a user's text editor and returns the results as a string. Can be used to open and edit exisiting files, or just as a scratch space for input. Useful for having a user edit text inline with a CLI program a la git commit -m
Built for my new (under development) daily journaling program in Rust: Echo
For all of these functions the user must have their $EDITOR environmental variable set (or you'll get an error telling you it is not set).
Open opens a text buffer in an editor with the contents of the file specified. This does not edit the contents of the file. Returns a Result
```rust use std::path::Path;
fn main() { let path = Path::new("hello.txt"); let output = match scrawl::open(path) { Ok(s) => s, Err(e) => e.to_string() }; println!("{}", output); } ```
Open opens a text buffer in an editor with the contents of the file specified. This does not edit the contents of the file. Returns a Result
```rust use std::path::Path;
fn main() { let path = Path::new("hello.txt"); let output = match scrawl::open(path) { Ok(s) => s, Err(e) => e.to_string() }; println!("{}", output); } ```
Edit opens a text buffer in an editor with the contents of the file specified. This does edit the contents of the file. Returns a Result
```rust use std::path::Path;
fn main() { let path = Path::new("hello.txt"); let output = match scrawl::edit(path) { Ok(s) => s, Err(e) => e.to_string() }; println!("{}", output); } ```