forked from extern/nushell
Remove dfr from dataframe commands (#5760)
* input and output tests * input and output types for dfr * expression converter * remove deprecated command * correct expressions * cargo clippy * identifier for ls * cargo clippy * type for head and tail expression * modify full cell path if block
This commit is contained in:
@ -3,7 +3,7 @@ use super::super::values::NuExpression;
|
||||
use nu_protocol::{
|
||||
ast::Call,
|
||||
engine::{Command, EngineState, Stack},
|
||||
Category, Example, PipelineData, ShellError, Signature, Span, Value,
|
||||
Category, Example, PipelineData, ShellError, Signature, Span, Type, Value,
|
||||
};
|
||||
|
||||
#[derive(Clone)]
|
||||
@ -11,7 +11,7 @@ pub struct ExprAsNu;
|
||||
|
||||
impl Command for ExprAsNu {
|
||||
fn name(&self) -> &str {
|
||||
"dfr as-nu"
|
||||
"to-nu"
|
||||
}
|
||||
|
||||
fn usage(&self) -> &str {
|
||||
@ -25,7 +25,7 @@ impl Command for ExprAsNu {
|
||||
fn examples(&self) -> Vec<Example> {
|
||||
vec![Example {
|
||||
description: "Convert a col expression into a nushell value",
|
||||
example: "dfr col col_a | dfr as-nu",
|
||||
example: "col a | to-nu",
|
||||
result: Some(Value::Record {
|
||||
cols: vec!["expr".into(), "value".into()],
|
||||
vals: vec![
|
||||
@ -34,7 +34,7 @@ impl Command for ExprAsNu {
|
||||
span: Span::test_data(),
|
||||
},
|
||||
Value::String {
|
||||
val: "col_a".into(),
|
||||
val: "a".into(),
|
||||
span: Span::test_data(),
|
||||
},
|
||||
],
|
||||
@ -43,6 +43,14 @@ impl Command for ExprAsNu {
|
||||
}]
|
||||
}
|
||||
|
||||
fn input_type(&self) -> Type {
|
||||
Type::Custom("expression".into())
|
||||
}
|
||||
|
||||
fn output_type(&self) -> Type {
|
||||
Type::Any
|
||||
}
|
||||
|
||||
fn run(
|
||||
&self,
|
||||
_engine_state: &EngineState,
|
||||
|
Reference in New Issue
Block a user