mirror of
https://github.com/nushell/nushell.git
synced 2025-05-06 02:54:25 +02:00
Preserve anchored meta data for all get queries in the pipeline
This commit is contained in:
parent
f57489ed92
commit
4a0ec1207c
@ -97,7 +97,7 @@ pub fn get_column_path(
|
|||||||
|
|
||||||
let res = match value {
|
let res = match value {
|
||||||
Ok(fetched) => match fetched {
|
Ok(fetched) => match fetched {
|
||||||
Some(Tagged { item: v, tag }) => Ok((v.clone()).tagged(&tag)),
|
Some(Tagged { item: v, .. }) => Ok((v.clone()).tagged(&obj.tag)),
|
||||||
None => match obj {
|
None => match obj {
|
||||||
// If its None check for certain values.
|
// If its None check for certain values.
|
||||||
Tagged {
|
Tagged {
|
||||||
@ -147,8 +147,14 @@ pub fn get(
|
|||||||
item: Value::Table(rows),
|
item: Value::Table(rows),
|
||||||
..
|
..
|
||||||
} => {
|
} => {
|
||||||
for item in rows {
|
for row in rows {
|
||||||
result.push_back(ReturnSuccess::value(item.clone()));
|
result.push_back(ReturnSuccess::value(
|
||||||
|
Tagged {
|
||||||
|
item: row.item,
|
||||||
|
tag: Tag::from(&item.tag),
|
||||||
|
}
|
||||||
|
.map_anchored(&item.tag.anchor),
|
||||||
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
other => result
|
other => result
|
||||||
|
@ -105,6 +105,17 @@ impl<T> Tagged<T> {
|
|||||||
mapped.tagged(tag)
|
mapped.tagged(tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn map_anchored(self, anchor: &Option<AnchorLocation>) -> Tagged<T> {
|
||||||
|
let mut tag = self.tag;
|
||||||
|
|
||||||
|
tag.anchor = anchor.clone();
|
||||||
|
|
||||||
|
Tagged {
|
||||||
|
item: self.item,
|
||||||
|
tag: tag,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn tag(&self) -> Tag {
|
pub fn tag(&self) -> Tag {
|
||||||
self.tag.clone()
|
self.tag.clone()
|
||||||
}
|
}
|
||||||
@ -418,16 +429,6 @@ impl Span {
|
|||||||
self.slice(source).to_string().spanned(*self)
|
self.slice(source).to_string().spanned(*self)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
pub fn unknown_with_uuid(uuid: Uuid) -> Span {
|
|
||||||
Span {
|
|
||||||
start: 0,
|
|
||||||
end: 0,
|
|
||||||
source: Some(uuid),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
pub fn start(&self) -> usize {
|
pub fn start(&self) -> usize {
|
||||||
self.start
|
self.start
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user