-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathauto_pair.rs
More file actions
20 lines (17 loc) · 585 Bytes
/
auto_pair.rs
File metadata and controls
20 lines (17 loc) · 585 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use lineeditor::DefaultAutoPair;
use lineeditor::LineEditor;
use lineeditor::LineEditorResult;
use lineeditor::StringPrompt;
fn main() {
let prompt = StringPrompt::new("prompt> ".to_string());
let mut line_editor = LineEditor::new(Box::new(prompt));
line_editor.set_auto_pair(Some(Box::<DefaultAutoPair>::default()));
let bindings = line_editor.keybinding();
bindings.register_common_control_bindings();
match line_editor.read_line() {
Ok(LineEditorResult::Success(line)) => {
println!("Line {}", line);
}
_ => {}
}
}