mirror of
https://github.com/nushell/nushell.git
synced 2025-01-11 00:38:23 +01:00
Print command help in base from+to commands (#6856)
This commit is contained in:
parent
46c0d29c08
commit
e3bf6fdfc0
@ -1,6 +1,7 @@
|
||||
use nu_engine::get_full_help;
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{Category, PipelineData, ShellError, Signature};
|
||||
use nu_protocol::{Category, IntoPipelineData, PipelineData, ShellError, Signature, Value};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct From;
|
||||
@ -20,11 +21,15 @@ impl Command for From {
|
||||
|
||||
fn run(
|
||||
&self,
|
||||
_engine_state: &EngineState,
|
||||
_stack: &mut Stack,
|
||||
engine_state: &EngineState,
|
||||
stack: &mut Stack,
|
||||
call: &Call,
|
||||
_input: PipelineData,
|
||||
) -> Result<nu_protocol::PipelineData, ShellError> {
|
||||
Ok(PipelineData::new(call.head))
|
||||
Ok(Value::String {
|
||||
val: get_full_help(&From.signature(), &From.examples(), engine_state, stack),
|
||||
span: call.head,
|
||||
}
|
||||
.into_pipeline_data())
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
use nu_engine::get_full_help;
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{Category, PipelineData, ShellError, Signature};
|
||||
use nu_protocol::{Category, IntoPipelineData, PipelineData, ShellError, Signature, Value};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct To;
|
||||
@ -20,11 +21,15 @@ impl Command for To {
|
||||
|
||||
fn run(
|
||||
&self,
|
||||
_engine_state: &EngineState,
|
||||
_stack: &mut Stack,
|
||||
engine_state: &EngineState,
|
||||
stack: &mut Stack,
|
||||
call: &Call,
|
||||
_input: PipelineData,
|
||||
) -> Result<nu_protocol::PipelineData, ShellError> {
|
||||
Ok(PipelineData::new(call.head))
|
||||
Ok(Value::String {
|
||||
val: get_full_help(&To.signature(), &To.examples(), engine_state, stack),
|
||||
span: call.head,
|
||||
}
|
||||
.into_pipeline_data())
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user