mirror of
https://github.com/nushell/nushell.git
synced 2024-11-08 01:24:38 +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 metadata = input.metadata();
|
||||
|
||||
let head_span = call.head;
|
||||
input
|
||||
.map(
|
||||
move |item| match item {
|
||||
@ -151,7 +152,13 @@ fn rename(
|
||||
|
||||
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(),
|
||||
)
|
||||
|
@ -61,8 +61,6 @@ fn keeps_remaining_original_names_given_less_new_names_than_total_original_names
|
||||
})
|
||||
}
|
||||
|
||||
// FIXME: jt: needs more work
|
||||
#[ignore]
|
||||
#[test]
|
||||
fn errors_if_no_columns_present() {
|
||||
Playground::setup("rename_test_3", |dirs, sandbox| {
|
||||
|
Loading…
Reference in New Issue
Block a user