Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
fuchsia.googlesource.com-third_party-rust-mirrors-rustyline
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
fuchsia-mirror
fuchsia.googlesource.com-third_party-rust-mirrors-rustyline
Commits
d0a1d759
Commit
d0a1d759
authored
9 years ago
by
Main
Browse files
Options
Downloads
Patches
Plain Diff
Update README.md for v0.1.0
parent
6cf9f5a6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
README.md
+46
-0
46 additions, 0 deletions
README.md
with
46 additions
and
0 deletions
README.md
+
46
−
0
View file @
d0a1d759
...
...
@@ -10,3 +10,49 @@ This project uses Cargo and Rust Stable
```
bash
cargo build
--release
```
## Example
``rust
extern crate rustyline;
use rustyline::error::ReadlineError;
use rustyline::Editor;
fn main() {
let mut rl = Editor::new();
if let Err(_) = rl.load_history("history.txt") {
println!("No previous history.");
}
loop {
let readline = rl.readline(">> ");
match readline {
Ok(line) => {
rl.add_history_entry(&line);
println!("Line: {}", line);
},
Err(ReadlineError::Interrupted) => {
println!("CTRL-C");
break
},
Err(ReadlineError::Eof) => {
println!("CTRL-D");
break
},
Err(err) => {
println!("Error: {:?}", err);
break
}
}
}
rl.save_history("history.txt").unwrap();
}
```
## crates.io
You can use this package in your project by adding the following
to your `
Cargo.toml
`:
``toml
[dependencies]
rustyline = "0.1.0"
`
``
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment