mirror of
https://github.com/nushell/nushell
synced 2025-01-15 14:44:14 +00:00
18 lines
381 B
Rust
18 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
|
||
|
}
|