mirror of
https://github.com/danbulant/nushell
synced 2026-06-13 11:41:49 +00:00
* get_columns is working in the columns command * the new location of the get_columns method is nu-protocol/src/column.rs * reference the new location of the get_columns method * move get_columns to nu-engine
17 lines
381 B
Rust
17 lines
381 B
Rust
use nu_protocol::Value;
|
|
|
|
pub fn get_columns(input: &[Value]) -> Vec<String> {
|
|
let mut columns = vec![];
|
|
|
|
for item in input {
|
|
if let Value::Record { cols, vals: _, .. } = item {
|
|
for col in cols {
|
|
if !columns.contains(col) {
|
|
columns.push(col.to_string());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
columns
|
|
}
|