nushell/crates/nu-command/src/core_commands/module.rs

37 lines
924 B
Rust
Raw Normal View History

2021-09-29 20:25:05 +02:00
use nu_protocol::ast::Call;
2021-10-25 08:31:39 +02:00
use nu_protocol::engine::{Command, EngineState, EvaluationContext, Stack};
2021-10-25 06:01:02 +02:00
use nu_protocol::{PipelineData, Signature, SyntaxShape, Value};
2021-09-29 20:25:05 +02:00
2021-10-25 06:01:02 +02:00
#[derive(Clone)]
2021-09-29 20:25:05 +02:00
pub struct Module;
impl Command for Module {
fn name(&self) -> &str {
"module"
}
fn usage(&self) -> &str {
"Define a custom module"
}
fn signature(&self) -> nu_protocol::Signature {
Signature::build("module")
.required("module_name", SyntaxShape::String, "module name")
.required(
"block",
SyntaxShape::Block(Some(vec![])),
"body of the module",
)
}
fn run(
&self,
2021-10-25 08:31:39 +02:00
_engine_state: &EngineState,
_stack: &mut Stack,
2021-09-29 20:25:05 +02:00
call: &Call,
2021-10-25 06:01:02 +02:00
_input: PipelineData,
) -> Result<nu_protocol::PipelineData, nu_protocol::ShellError> {
Ok(PipelineData::new())
2021-09-29 20:25:05 +02:00
}
}