mirror of
https://github.com/nushell/nushell.git
synced 2025-07-02 15:40:38 +02:00
Implementing Command for Echo, no examples
Referring to: https://github.com/nushell/nushell/blob/main/crates/nu-command/src/commands/core_commands/echo.rs as the original implementation.
This commit is contained in:
32
crates/nu-command/src/core_commands/echo.rs
Normal file
32
crates/nu-command/src/core_commands/echo.rs
Normal file
@ -0,0 +1,32 @@
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{PipelineData, ShellError, Signature, SyntaxShape};
|
||||
//TODO: add Example
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Echo;
|
||||
|
||||
impl Command for Echo {
|
||||
fn name(&self) -> &str {
|
||||
"echo"
|
||||
}
|
||||
|
||||
fn usage(&self) -> &str {
|
||||
"Echo the arguments back to the user."
|
||||
}
|
||||
|
||||
fn signature(&self) -> Signature {
|
||||
Signature::build("echo").rest("rest", SyntaxShape::Any, "the values to echo")
|
||||
}
|
||||
|
||||
fn run(
|
||||
&self,
|
||||
_engine_state: &EngineState,
|
||||
_stack: &mut Stack,
|
||||
_call: &Call,
|
||||
input: PipelineData,
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
Ok(input)
|
||||
}
|
||||
//TODO: implement fn examples(&self) -> Vec<Example>
|
||||
}
|
Reference in New Issue
Block a user