2019-08-07 17:49:11 +00:00
|
|
|
use crate::commands::command::CallInfo;
|
|
|
|
use crate::errors::ShellError;
|
2019-08-09 04:51:21 +00:00
|
|
|
use crate::shell::completer::CompletionPair;
|
2019-08-07 17:49:11 +00:00
|
|
|
use crate::stream::{InputStream, OutputStream};
|
2019-08-09 04:51:21 +00:00
|
|
|
use rustyline::error::ReadlineError;
|
2019-08-07 17:49:11 +00:00
|
|
|
|
2019-08-09 04:51:21 +00:00
|
|
|
pub trait Shell {
|
2019-08-07 17:49:11 +00:00
|
|
|
fn name(&self) -> String;
|
|
|
|
fn ls(&self, call_info: CallInfo, input: InputStream) -> Result<OutputStream, ShellError>;
|
|
|
|
fn cd(&self, call_info: CallInfo, input: InputStream) -> Result<OutputStream, ShellError>;
|
|
|
|
fn path(&self) -> String;
|
|
|
|
fn set_path(&mut self, path: String);
|
2019-08-09 04:51:21 +00:00
|
|
|
|
|
|
|
// fn complete(
|
|
|
|
// &self,
|
|
|
|
// line: &str,
|
|
|
|
// pos: usize,
|
|
|
|
// ctx: &rustyline::Context<'_>,
|
|
|
|
// ) -> Result<(usize, Vec<CompletionPair>), ReadlineError>;
|
|
|
|
|
|
|
|
fn hint(&self, _line: &str, _pos: usize, _ctx: &rustyline::Context<'_>) -> Option<String>;
|
2019-08-07 17:49:11 +00:00
|
|
|
}
|