mirror of
https://github.com/nushell/nushell.git
synced 2025-01-08 23:40:17 +01:00
now tableview forces being a table
This commit is contained in:
parent
aeb0c2e7a8
commit
62310caa32
@ -13,13 +13,24 @@ pub struct TableView {
|
||||
}
|
||||
|
||||
impl TableView {
|
||||
fn merge_descriptors(values: &[Value]) -> Vec<DataDescriptor> {
|
||||
let mut ret = vec![];
|
||||
for value in values {
|
||||
for desc in value.data_descriptors() {
|
||||
if !ret.contains(&desc) {
|
||||
ret.push(desc);
|
||||
}
|
||||
}
|
||||
}
|
||||
ret
|
||||
}
|
||||
|
||||
pub fn from_list(values: &[Value]) -> Option<TableView> {
|
||||
if values.len() == 0 {
|
||||
return None;
|
||||
}
|
||||
|
||||
let item = &values[0];
|
||||
let headers = item.data_descriptors();
|
||||
let headers = TableView::merge_descriptors(values);
|
||||
|
||||
if headers.len() == 0 {
|
||||
return None;
|
||||
|
Loading…
Reference in New Issue
Block a user