Simplify describe (#933)

This commit is contained in:
JT 2022-02-04 14:51:36 -05:00 committed by GitHub
parent ece1e43238
commit 90f6b6aedf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,8 @@
use nu_protocol::ast::Call; use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, Value}; use nu_protocol::{
Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Value,
};
#[derive(Clone)] #[derive(Clone)]
pub struct Describe; pub struct Describe;
@ -20,7 +22,7 @@ impl Command for Describe {
fn run( fn run(
&self, &self,
engine_state: &EngineState, _engine_state: &EngineState,
_stack: &mut Stack, _stack: &mut Stack,
call: &Call, call: &Call,
input: PipelineData, input: PipelineData,
@ -32,13 +34,12 @@ impl Command for Describe {
None, None,
)) ))
} else { } else {
input.map( let value = input.into_value(call.head);
move |x| Value::String { Ok(Value::String {
val: x.get_type().to_string(), val: value.get_type().to_string(),
span: head, span: head,
}, }
engine_state.ctrlc.clone(), .into_pipeline_data())
)
} }
} }