mirror of
https://github.com/nushell/nushell.git
synced 2025-02-11 16:09:38 +01:00
Simplify describe (#933)
This commit is contained in:
parent
ece1e43238
commit
90f6b6aedf
@ -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())
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user