better print out for stream output

This commit is contained in:
Fernando Herrera
2021-09-24 13:03:39 +01:00
parent 6c589affe7
commit b4977f1515
5 changed files with 26 additions and 24 deletions

View File

@ -69,4 +69,8 @@ pub enum ShellError {
#[error("External command")]
#[diagnostic(code(nu::shell::external_command), url(docsrs))]
ExternalCommand(String, #[label("{0}")] Span),
#[error("Unsupported input")]
#[diagnostic(code(nu::shell::unsupported_input), url(docsrs))]
UnsupportedInput(String, #[label("{0}")] Span),
}

View File

@ -6,12 +6,9 @@ pub struct ValueStream(pub Rc<RefCell<dyn Iterator<Item = Value>>>);
impl ValueStream {
pub fn into_string(self) -> String {
format!(
"[{}]",
self.map(|x: Value| x.into_string())
.collect::<Vec<String>>()
.join(", ")
)
self.map(|x: Value| x.into_string())
.collect::<Vec<String>>()
.join("\n")
}
pub fn from_stream(input: impl Iterator<Item = Value> + 'static) -> ValueStream {