mirror of
https://github.com/nushell/nushell.git
synced 2025-05-31 15:18:23 +02:00
Rebuild indexmap with proper headers
This commit is contained in:
parent
1b9c006696
commit
60a696ebe9
@ -54,8 +54,25 @@ pub fn count(
|
|||||||
_ => ()
|
_ => ()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let mut newrows: Vec<_> = vec![];
|
||||||
|
for r in rows.iter().skip(1) {
|
||||||
|
match &r.value {
|
||||||
|
UntaggedValue::Row(d) => {
|
||||||
|
let mut i = 0;
|
||||||
|
let mut newrow = IndexMap::new();
|
||||||
|
|
||||||
|
for (_, v) in d.entries.iter() {
|
||||||
|
newrow.insert(headers[i].clone(), v);
|
||||||
|
i += 1;
|
||||||
|
}
|
||||||
|
newrows.push(newrow);
|
||||||
|
}
|
||||||
|
_ => panic!("huh?")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let mut file = File::create("headout").unwrap();
|
let mut file = File::create("headout").unwrap();
|
||||||
write!(file, "args: {:#?}", headers);
|
write!(file, "args: {:#?}", newrows).unwrap();
|
||||||
|
|
||||||
yield ReturnSuccess::value(UntaggedValue::int(rows.len()).into_value(name))
|
yield ReturnSuccess::value(UntaggedValue::int(rows.len()).into_value(name))
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user