auto_pair/
auto_pair.rs

1use lineeditor::DefaultAutoPair;
2use lineeditor::LineEditor;
3use lineeditor::LineEditorResult;
4use lineeditor::StringPrompt;
5
6fn main() {
7    let prompt = StringPrompt::new("prompt> ".to_string());
8    let mut line_editor = LineEditor::new(Box::new(prompt));
9    line_editor.set_auto_pair(Some(Box::<DefaultAutoPair>::default()));
10
11    let bindings = line_editor.keybinding();
12    bindings.register_common_control_bindings();
13
14    match line_editor.read_line() {
15        Ok(LineEditorResult::Success(line)) => {
16            println!("Line {}", line);
17        }
18        _ => {}
19    }
20}