nushell/src/format/list.rs
Yehuda Katz 7fa09f59c2 Remove unused code
Closes #467
2019-09-01 23:11:05 -07:00

23 lines
566 B
Rust

use crate::format::RenderView;
use crate::prelude::*;
use derive_new::new;
// A list is printed one line at a time with an optional separator between groups
#[derive(new)]
pub struct ListView {
list: Vec<Vec<String>>,
sep: String,
}
impl RenderView for ListView {
fn render_view(&self, host: &mut dyn Host) -> Result<(), ShellError> {
for output in &self.list {
let string: String = output.iter().map(|l| format!("{}\n", l)).collect();
host.stdout(&format!("{}{}", string, self.sep));
}
Ok(())
}
}