plugin feature flag

This commit is contained in:
Fernando Herrera
2021-11-02 20:56:00 +00:00
parent dfb846dec6
commit 12eed1f98a
11 changed files with 34 additions and 44 deletions

View File

@ -13,7 +13,6 @@ nu-protocol = { path = "../nu-protocol" }
nu-table = { path = "../nu-table" }
nu-term-grid = { path = "../nu-term-grid" }
nu-parser = { path = "../nu-parser" }
nu-plugin = { path = "../nu-plugin" }
trash = { version = "1.3.0", optional = true }
unicode-segmentation = "1.8.0"
@ -34,3 +33,4 @@ titlecase = "1.1.0"
[features]
trash-support = ["trash"]
plugin = ["nu-parser/plugin"]

View File

@ -9,8 +9,6 @@ mod hide;
mod if_;
mod let_;
mod module;
mod register;
mod run_plugin;
mod source;
mod use_;
@ -25,7 +23,11 @@ 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;
#[cfg(feature = "plugin")]
mod register;
#[cfg(feature = "plugin")]
pub use register::Register;

View File

@ -1,30 +0,0 @@
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

@ -73,10 +73,8 @@ pub fn create_default_context() -> EngineState {
Mv,
ParEach,
Ps,
Register,
Range,
Rm,
RunPlugin,
Select,
Size,
Split,
@ -94,6 +92,9 @@ pub fn create_default_context() -> EngineState {
Zip
);
#[cfg(feature = "plugin")]
bind_command!(Register);
// This is a WIP proof of concept
bind_command!(ListGitBranches, Git, GitCheckout, Source);