Initial commit

This commit is contained in:
2025-06-20 16:12:40 +02:00
commit 64746d2a6c
20 changed files with 1637 additions and 0 deletions

17
rdraught-cli/Cargo.toml Normal file
View File

@@ -0,0 +1,17 @@
[package]
name = "rdraught-cli"
authors.workspace = true
edition.workspace = true
homepage.workspace = true
license.workspace = true
repository.workspace = true
rust-version.workspace = true
version.workspace = true
[[bin]]
name = "rustyline-test"
path = "src/rustyline-test.rs"
[dependencies]
#reedline = "0.40"
rustyline = {version = "16.0", default-features = false }

View File

@@ -0,0 +1,33 @@
use rustyline::error::ReadlineError;
use rustyline::{DefaultEditor, Result};
fn main() -> Result<()> {
// `()` can be used when no completer is required
let mut rl = DefaultEditor::new()?;
/* if rl.load_history("history.txt").is_err() {
println!("No previous history.");
} */
loop {
let readline = rl.readline(">> ");
match readline {
Ok(line) => {
rl.add_history_entry(line.as_str())?;
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();
Ok(())
}