forked from extern/nushell
better print out for stream output
This commit is contained in:
@ -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),
|
||||
}
|
||||
|
@ -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 {
|
||||
|
Reference in New Issue
Block a user