mirror of
https://github.com/nushell/nushell.git
synced 2025-01-27 00:28:41 +01:00
add rename (#5534)
This commit is contained in:
parent
65bac77e8a
commit
06f40405fe
@ -112,6 +112,7 @@ fn rename(
|
|||||||
let columns: Vec<String> = call.rest(engine_state, stack, 0)?;
|
let columns: Vec<String> = call.rest(engine_state, stack, 0)?;
|
||||||
let metadata = input.metadata();
|
let metadata = input.metadata();
|
||||||
|
|
||||||
|
let head_span = call.head;
|
||||||
input
|
input
|
||||||
.map(
|
.map(
|
||||||
move |item| match item {
|
move |item| match item {
|
||||||
@ -151,7 +152,13 @@ fn rename(
|
|||||||
|
|
||||||
Value::Record { cols, vals, span }
|
Value::Record { cols, vals, span }
|
||||||
}
|
}
|
||||||
x => x,
|
x => Value::Error {
|
||||||
|
error: ShellError::UnsupportedInput(
|
||||||
|
"can't rename: input is not table, so no column names available for rename"
|
||||||
|
.to_string(),
|
||||||
|
x.span().unwrap_or(head_span),
|
||||||
|
),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
engine_state.ctrlc.clone(),
|
engine_state.ctrlc.clone(),
|
||||||
)
|
)
|
||||||
|
@ -61,8 +61,6 @@ fn keeps_remaining_original_names_given_less_new_names_than_total_original_names
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: jt: needs more work
|
|
||||||
#[ignore]
|
|
||||||
#[test]
|
#[test]
|
||||||
fn errors_if_no_columns_present() {
|
fn errors_if_no_columns_present() {
|
||||||
Playground::setup("rename_test_3", |dirs, sandbox| {
|
Playground::setup("rename_test_3", |dirs, sandbox| {
|
||||||
|
Loading…
Reference in New Issue
Block a user