mirror of
https://github.com/nushell/nushell.git
synced 2025-04-30 16:14:27 +02:00
* saving signatures to file * loading plugin signature from file * is_plugin column for help command
38 lines
956 B
Rust
38 lines
956 B
Rust
use nu_protocol::ast::Call;
|
|
use nu_protocol::engine::{Command, EngineState, Stack};
|
|
use nu_protocol::{Category, 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",
|
|
)
|
|
.optional("signature", SyntaxShape::Any, "plugin signature")
|
|
.category(Category::Core)
|
|
}
|
|
|
|
fn run(
|
|
&self,
|
|
_engine_state: &EngineState,
|
|
_stack: &mut Stack,
|
|
call: &Call,
|
|
_input: PipelineData,
|
|
) -> Result<nu_protocol::PipelineData, nu_protocol::ShellError> {
|
|
Ok(PipelineData::new(call.head))
|
|
}
|
|
}
|