This commit is contained in:
Jonathan Turner
2019-08-10 08:49:43 +12:00
parent 34759b7646
commit eeed31837f
17 changed files with 47 additions and 288 deletions

View File

@ -1,6 +1,5 @@
use derive_new::new;
use rustyline::completion::{self, Completer, FilenameCompleter};
use rustyline::line_buffer::LineBuffer;
use rustyline::completion::{Completer, FilenameCompleter};
#[derive(new)]
crate struct NuCompleter {
@ -8,20 +7,6 @@ crate struct NuCompleter {
//pub commands: indexmap::IndexMap<String, Arc<dyn Command>>,
}
pub struct CompletionPair {
pub display: String,
pub replacement: String,
}
impl Into<completion::Pair> for CompletionPair {
fn into(self) -> completion::Pair {
completion::Pair {
display: self.display,
replacement: self.replacement,
}
}
}
impl NuCompleter {
pub fn complete(
&self,
@ -89,8 +74,8 @@ impl NuCompleter {
Ok((replace_pos, completions))
}
fn update(&self, line: &mut LineBuffer, start: usize, elected: &str) {
let end = line.pos();
line.replace(start..end, elected)
}
// fn update(&self, line: &mut LineBuffer, start: usize, elected: &str) {
// let end = line.pos();
// line.replace(start..end, elected)
// }
}

View File

@ -1,4 +1,4 @@
use crate::commands::command::{CallInfo, EvaluatedStaticCommandArgs};
use crate::commands::command::EvaluatedStaticCommandArgs;
use crate::object::dir_entry_dict;
use crate::prelude::*;
use crate::shell::completer::NuCompleter;

View File

@ -1,6 +1,6 @@
use crate::commands::command::{CallInfo, EvaluatedStaticCommandArgs};
use crate::commands::command::EvaluatedStaticCommandArgs;
use crate::errors::ShellError;
use crate::stream::{InputStream, OutputStream};
use crate::stream::OutputStream;
pub trait Shell {
fn name(&self) -> String;

View File

@ -1,8 +1,8 @@
use crate::commands::command::{CallInfo, EvaluatedStaticCommandArgs};
use crate::commands::command::EvaluatedStaticCommandArgs;
use crate::errors::ShellError;
use crate::shell::filesystem_shell::FilesystemShell;
use crate::shell::shell::Shell;
use crate::stream::{InputStream, OutputStream};
use crate::stream::OutputStream;
use std::error::Error;
use std::sync::{Arc, Mutex};

View File

@ -1,4 +1,4 @@
use crate::commands::command::{CallInfo, EvaluatedStaticCommandArgs};
use crate::commands::command::EvaluatedStaticCommandArgs;
use crate::prelude::*;
use crate::shell::shell::Shell;
use std::ffi::OsStr;