6 releases
| 0.1.5 | Dec 17, 2023 |
|---|---|
| 0.1.4 | Jun 1, 2022 |
| 0.1.3 | Feb 26, 2021 |
| 0.1.2 | Jul 6, 2020 |
| 0.1.1 | Jan 22, 2020 |
#73 in Text processing
25,223 downloads per month
Used in 92 crates
(78 directly)
16KB
154 lines
edit lets you open and edit something in a text editor, regardless of platform.
(Think git commit.)
It works on Windows, Mac, and Linux, and knows about lots of different text editors to fall
back upon in case standard environment variables such as VISUAL and EDITOR aren't set.
let template = "Fill in the blank: Hello, _____!";
let edited = edit::edit(template)?;
println!("after editing: '{}'", edited);
// after editing: 'Fill in the blank: Hello, world!'
Features
The edit crate has the following optional features:
-
better-path(enabled by default) — Usewhichto locate executable programs inPATH. If this is disabled, programs are still looked up inPATH, but a basic search is used that does not check for executability. -
quoted-env— Useshell-wordsto split apart the values of theVISUALandEDITORenvironment variables. If this is disabled, the envvars are split up on whitespace.
edit
edit is a Rust library that lets you open and edit something in a text editor, regardless of platform. (Think git commit.)
It works on Windows, Mac, and Linux, and knows about lots of different text editors to fall back upon in case standard environment variables such as VISUAL and EDITOR aren't set.
let template = "Fill in the blank: Hello, _____!";
let edited = edit::edit(template)?;
println!("after editing: '{}'", edited);
// after editing: 'Fill in the blank: Hello, world!'
Dependencies
~2–13MB
~132K SLoC