17 个版本 (5 个破坏性版本)
使用旧的 Rust 2015
| 0.5.2 | 2016 年 6 月 17 日 |
|---|---|
| 0.5.0 | 2016 年 5 月 25 日 |
| 0.4.1 | 2015 年 12 月 27 日 |
| 0.1.2 | 2015 年 7 月 29 日 |
| 0.0.4 | 2015 年 3 月 26 日 |
#13 in #readline
每月下载量 36 次
用于 3 个 crate (2 个直接使用)
2.5MB
31K SLoC
包含 (自动工具混淆代码, 215KB) readline/configure, (自动工具混淆代码, 160KB) readline/examples/rlfe/configure, (模糊 autoconf 代码, 8KB) readline/configure.ac
readline-sys
版本
libreadline 的本地绑定。
功能
- 围绕
readline和add_history的薄包装 - 将历史记录行写入文件:
add_history_persist - 从文件加载历史记录:
preload_history - 库版本:
version
API 文档
用法
在 Cargo.toml 中将 rl-sys 添加为依赖项
[dependencies]
rl-sys = "~0.5.2"
使用 rl_sys::readline 的 cat 的简单实现
extern crate rl_sys;
use rl_sys::readline;
use rl_sys::history::listmgmt;
fn main() {
loop {
let input: String = match readline::readline("") {
Ok(Some(s)) => s,
Ok(None) => break, // user entered ctrl-d
Err(e) => {
println!("{}", e);
continue;
}
};
println!("{}", input);
// Enables up/down arrow scrolling through history
listmgmt::add(&input).unwrap();
}
}
查看 示例目录 中的更全面的 shell 示例。
开发
要为此 crate 工作,请记住使用 git clone --recursive 或 git submodule init && git submodule update。
许可
在 GNU 通用公共许可证 下分发。