6 个版本
| 0.1.5 | 2023年12月17日 |
|---|---|
| 0.1.4 | 2022年6月1日 |
| 0.1.3 | 2021年2月26日 |
| 0.1.2 | 2020年7月6日 |
| 0.1.1 | 2020年1月22日 |
#11 in 文本编辑器
9,739 每月下载量
用于 62 个 crate (51 直接)
16KB
154 行
编辑
edit 是一个 Rust 库,允许您在文本编辑器中打开和编辑某些内容,不受平台限制。(想想 git commit。)
它支持 Windows、Mac 和 Linux,并在标准环境变量(如 VISUAL 和 EDITOR)未设置时知道许多不同的文本编辑器作为后备。
let template = "Fill in the blank: Hello, _____!";
let edited = edit::edit(template)?;
println!("after editing: '{}'", edited);
// after editing: 'Fill in the blank: Hello, world!'
lib.rs:
edit 允许您在文本编辑器中打开和编辑某些内容,不受平台限制。(想想 git commit。)
它支持 Windows、Mac 和 Linux,并在 知道 许多不同的文本编辑器作为后备,以防标准环境变量(如 VISUAL 和 EDITOR)未设置。
let template = "Fill in the blank: Hello, _____!";
let edited = edit::edit(template)?;
println!("after editing: '{}'", edited);
// after editing: 'Fill in the blank: Hello, world!'
特性
edit crate 具有以下可选特性
-
better-path(默认启用) — 使用which在PATH中定位可执行程序。如果禁用此功能,程序仍然会在PATH中查找,但使用的基本搜索不会检查可执行性。 -
quoted-env— 使用shell-words来分割VISUAL和EDITOR环境变量的值。如果禁用此功能,则按空白字符分割环境变量。
依赖关系
~1.6–9.5MB
~102K SLoC