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::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)]
pub struct Describe;
@ -20,7 +22,7 @@ impl Command for Describe {
fn run(
&self,
engine_state: &EngineState,
_engine_state: &EngineState,
_stack: &mut Stack,
call: &Call,
input: PipelineData,
@ -32,13 +34,12 @@ impl Command for Describe {
None,
))
} else {
input.map(
move |x| Value::String {
val: x.get_type().to_string(),
let value = input.into_value(call.head);
Ok(Value::String {
val: value.get_type().to_string(),
span: head,
},
engine_state.ctrlc.clone(),
)
}
.into_pipeline_data())
}
}