refactor(get_command): spawn rustyline instance from main()
This commit is contained in:
parent
3d4ab2e2e4
commit
fe66326956
4 changed files with 19 additions and 16 deletions
12
src/cli.rs
12
src/cli.rs
|
|
@ -1,11 +1,5 @@
|
|||
use rustyline::DefaultEditor;
|
||||
use rustyline::{Editor, history::FileHistory};
|
||||
|
||||
pub fn read_input() -> Option<String> {
|
||||
let mut rl = DefaultEditor::new().ok()?;
|
||||
|
||||
let readline = rl.readline("osdb> ");
|
||||
match readline {
|
||||
Ok(line) => Some(line),
|
||||
Err(_) => None,
|
||||
}
|
||||
pub fn read_input(rl: &mut Editor<(), FileHistory>) -> Option<String> {
|
||||
rl.readline("osdb> ").ok()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue