mirror of
https://github.com/nushell/nushell.git
synced 2025-05-01 00:24:29 +02:00
Updates commands to work after tag is no longer copy.
This commit is contained in:
parent
65546646a7
commit
b2c53a0967
@ -71,18 +71,18 @@ fn from_ssv_string_to_value(
|
|||||||
let rows = string_to_table(s, headerless)
|
let rows = string_to_table(s, headerless)
|
||||||
.iter()
|
.iter()
|
||||||
.map(|row| {
|
.map(|row| {
|
||||||
let mut tagged_dict = TaggedDictBuilder::new(tag);
|
let mut tagged_dict = TaggedDictBuilder::new(&tag);
|
||||||
for (col, entry) in row {
|
for (col, entry) in row {
|
||||||
tagged_dict.insert_tagged(
|
tagged_dict.insert_tagged(
|
||||||
col,
|
col,
|
||||||
Value::Primitive(Primitive::String(String::from(entry))).tagged(tag),
|
Value::Primitive(Primitive::String(String::from(entry))).tagged(&tag),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
tagged_dict.into_tagged_value()
|
tagged_dict.into_tagged_value()
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
Some(Tagged::from_item(Value::Table(rows), tag))
|
Some(Value::Table(rows).tagged(&tag))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn from_ssv(
|
fn from_ssv(
|
||||||
@ -96,7 +96,7 @@ fn from_ssv(
|
|||||||
|
|
||||||
for value in values {
|
for value in values {
|
||||||
let value_tag = value.tag();
|
let value_tag = value.tag();
|
||||||
latest_tag = Some(value_tag);
|
latest_tag = Some(value_tag.clone());
|
||||||
match value.item {
|
match value.item {
|
||||||
Value::Primitive(Primitive::String(s)) => {
|
Value::Primitive(Primitive::String(s)) => {
|
||||||
concat_string.push_str(&s);
|
concat_string.push_str(&s);
|
||||||
@ -104,27 +104,27 @@ fn from_ssv(
|
|||||||
_ => yield Err(ShellError::labeled_error_with_secondary (
|
_ => yield Err(ShellError::labeled_error_with_secondary (
|
||||||
"Expected a string from pipeline",
|
"Expected a string from pipeline",
|
||||||
"requires string input",
|
"requires string input",
|
||||||
name,
|
&name,
|
||||||
"value originates from here",
|
"value originates from here",
|
||||||
value_tag
|
&value_tag
|
||||||
)),
|
)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
match from_ssv_string_to_value(&concat_string, headerless, name) {
|
match from_ssv_string_to_value(&concat_string, headerless, name.clone()) {
|
||||||
Some(x) => match x {
|
Some(x) => match x {
|
||||||
Tagged { item: Value::Table(list), ..} => {
|
Tagged { item: Value::Table(list), ..} => {
|
||||||
for l in list { yield ReturnSuccess::value(l) }
|
for l in list { yield ReturnSuccess::value(l) }
|
||||||
}
|
}
|
||||||
x => yield ReturnSuccess::value(x)
|
x => yield ReturnSuccess::value(x)
|
||||||
},
|
},
|
||||||
None => if let Some(last_tag) = latest_tag {
|
None => if let Some(tag) = latest_tag {
|
||||||
yield Err(ShellError::labeled_error_with_secondary(
|
yield Err(ShellError::labeled_error_with_secondary(
|
||||||
"Could not parse as SSV",
|
"Could not parse as SSV",
|
||||||
"input cannot be parsed ssv",
|
"input cannot be parsed ssv",
|
||||||
name,
|
&name,
|
||||||
"value originates from here",
|
"value originates from here",
|
||||||
last_tag,
|
&tag,
|
||||||
))
|
))
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user