Browse Source

feat: add history suggestions

main
fdai7381 2 years ago
parent
commit
3a8bea9b4e
  1. 4
      src/main.rs

4
src/main.rs

@ -5,6 +5,7 @@ use execute::interpret;
use rustyline::completion::FilenameCompleter;
use rustyline::config::Configurer;
use rustyline::error::ReadlineError;
use rustyline::hint::HistoryHinter;
use rustyline::{CompletionType, Config, Editor, Result};
use rustyline_derive::{Completer, Helper, Highlighter, Hinter, Validator};
use whoami::username;
@ -20,6 +21,8 @@ mod prompt;
struct EditorHelper {
#[rustyline(Completer)]
completer: FilenameCompleter,
#[rustyline(Hinter)]
hinter: HistoryHinter,
}
fn main() -> Result<()> {
@ -34,6 +37,7 @@ fn main() -> Result<()> {
let helper = EditorHelper {
completer: FilenameCompleter::new(),
hinter: HistoryHinter {},
};
let mut rl = Editor::with_config(config)?;

Loading…
Cancel
Save