mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 16:15:20 +02:00
move get_columns from the table_viewer to a central location (#628)
* 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
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
use lscolors::{LsColors, Style};
|
||||
use nu_color_config::{get_color_config, style_primitive};
|
||||
use nu_engine::column::get_columns;
|
||||
use nu_engine::{env_to_string, CallExt};
|
||||
use nu_protocol::ast::{Call, PathMember};
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
@ -244,22 +245,6 @@ impl Command for Table {
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
fn convert_to_table(
|
||||
row_offset: usize,
|
||||
input: &[Value],
|
||||
|
Reference in New Issue
Block a user