2019-08-09 20:49:43 +00:00
|
|
|
use crate::commands::command::EvaluatedStaticCommandArgs;
|
2019-08-07 17:49:11 +00:00
|
|
|
use crate::errors::ShellError;
|
2019-08-09 20:49:43 +00:00
|
|
|
use crate::stream::OutputStream;
|
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;
|
2019-08-09 05:36:43 +00:00
|
|
|
fn ls(&self, args: EvaluatedStaticCommandArgs) -> Result<OutputStream, ShellError>;
|
2019-08-09 19:42:23 +00:00
|
|
|
fn cd(&self, args: EvaluatedStaticCommandArgs) -> Result<OutputStream, ShellError>;
|
2019-08-07 17:49:11 +00:00
|
|
|
fn path(&self) -> String;
|
|
|
|
fn set_path(&mut self, path: String);
|
2019-08-09 04:51:21 +00:00
|
|
|
|
2019-08-09 19:42:23 +00:00
|
|
|
fn complete(
|
|
|
|
&self,
|
|
|
|
line: &str,
|
|
|
|
pos: usize,
|
|
|
|
ctx: &rustyline::Context<'_>,
|
|
|
|
) -> Result<(usize, Vec<rustyline::completion::Pair>), rustyline::error::ReadlineError>;
|
2019-08-09 04:51:21 +00:00
|
|
|
|
|
|
|
fn hint(&self, _line: &str, _pos: usize, _ctx: &rustyline::Context<'_>) -> Option<String>;
|
2019-08-07 17:49:11 +00:00
|
|
|
}
|