mirror of
https://github.com/nushell/nushell.git
synced 2025-04-24 21:28:20 +02:00
Rebuild result properly
This commit is contained in:
parent
60a696ebe9
commit
6c59a452f1
@ -1,5 +1,6 @@
|
|||||||
use crate::commands::WholeStreamCommand;
|
use crate::commands::WholeStreamCommand;
|
||||||
use indexmap::IndexMap;
|
use indexmap::IndexMap;
|
||||||
|
use nu_protocol::Dictionary;
|
||||||
use crate::context::CommandRegistry;
|
use crate::context::CommandRegistry;
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
use futures::stream::StreamExt;
|
use futures::stream::StreamExt;
|
||||||
@ -54,7 +55,7 @@ pub fn count(
|
|||||||
_ => ()
|
_ => ()
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut newrows: Vec<_> = vec![];
|
let mut newrows: Vec<Value> = vec![];
|
||||||
for r in rows.iter().skip(1) {
|
for r in rows.iter().skip(1) {
|
||||||
match &r.value {
|
match &r.value {
|
||||||
UntaggedValue::Row(d) => {
|
UntaggedValue::Row(d) => {
|
||||||
@ -62,10 +63,10 @@ pub fn count(
|
|||||||
let mut newrow = IndexMap::new();
|
let mut newrow = IndexMap::new();
|
||||||
|
|
||||||
for (_, v) in d.entries.iter() {
|
for (_, v) in d.entries.iter() {
|
||||||
newrow.insert(headers[i].clone(), v);
|
newrow.insert(headers[i].clone(), v.clone());
|
||||||
i += 1;
|
i += 1;
|
||||||
}
|
}
|
||||||
newrows.push(newrow);
|
newrows.push(UntaggedValue::Row(Dictionary{entries: newrow}).into_value(r.tag.clone()));
|
||||||
}
|
}
|
||||||
_ => panic!("huh?")
|
_ => panic!("huh?")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user