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