nushell/src/shell/shell.rs

22 lines
808 B
Rust
Raw Normal View History

2019-08-15 05:02:02 +00:00
use crate::commands::command::EvaluatedWholeStreamCommandArgs;
2019-08-10 20:18:14 +00:00
use crate::context::SourceMap;
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
pub trait Shell: std::fmt::Debug {
2019-08-10 20:18:14 +00:00
fn name(&self, source_map: &SourceMap) -> String;
2019-08-15 05:02:02 +00:00
fn ls(&self, args: EvaluatedWholeStreamCommandArgs) -> Result<OutputStream, ShellError>;
fn cd(&self, args: EvaluatedWholeStreamCommandArgs) -> 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
}