Merge pull request #270 from elferherrera/plugins

Plugins for engine q
This commit is contained in:
JT
2021-11-02 19:07:45 +13:00
committed by GitHub
23 changed files with 6010 additions and 3 deletions

View File

@ -9,6 +9,8 @@ mod hide;
mod if_;
mod let_;
mod module;
mod register;
mod run_plugin;
mod source;
mod use_;
@ -23,5 +25,7 @@ pub use hide::Hide;
pub use if_::If;
pub use let_::Let;
pub use module::Module;
pub use register::Register;
pub use run_plugin::RunPlugin;
pub use source::Source;
pub use use_::Use;

View File

@ -0,0 +1,34 @@
use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{PipelineData, Signature, SyntaxShape};
#[derive(Clone)]
pub struct Register;
impl Command for Register {
fn name(&self) -> &str {
"register"
}
fn usage(&self) -> &str {
"Register a plugin"
}
fn signature(&self) -> nu_protocol::Signature {
Signature::build("register").required(
"plugin",
SyntaxShape::Filepath,
"location of bin for plugin",
)
}
fn run(
&self,
_engine_state: &EngineState,
_stack: &mut Stack,
_call: &Call,
_input: PipelineData,
) -> Result<nu_protocol::PipelineData, nu_protocol::ShellError> {
Ok(PipelineData::new())
}
}

View File

@ -0,0 +1,30 @@
use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{PipelineData, Signature};
#[derive(Clone)]
pub struct RunPlugin;
impl Command for RunPlugin {
fn name(&self) -> &str {
"run_plugin"
}
fn usage(&self) -> &str {
"test for plugin encoding"
}
fn signature(&self) -> nu_protocol::Signature {
Signature::build("run_plugin")
}
fn run(
&self,
_context: &EngineState,
_stack: &mut Stack,
_call: &Call,
_input: PipelineData,
) -> Result<nu_protocol::PipelineData, nu_protocol::ShellError> {
Ok(PipelineData::new())
}
}

View File

@ -72,8 +72,10 @@ pub fn create_default_context() -> EngineState {
Mv,
ParEach,
Ps,
Register,
Range,
Rm,
RunPlugin,
Select,
Size,
Split,