nushell/crates/nu_plugin_tree/src/nu/mod.rs
JT 383e874166
Fix a bunch of future clippy warnings (#3586)
* Fix a bunch of future clippy warnings

* Fix a bunch of future clippy warnings
2021-06-10 07:08:12 +12:00

22 lines
596 B
Rust

use nu_errors::ShellError;
use nu_plugin::Plugin;
use nu_protocol::{CallInfo, Signature, Value};
use crate::tree::TreeView;
use crate::TreeViewer;
impl Plugin for TreeViewer {
fn config(&mut self) -> Result<Signature, ShellError> {
Ok(Signature::build("tree").desc("View the contents of the pipeline as a tree."))
}
fn sink(&mut self, _call_info: CallInfo, input: Vec<Value>) {
if !input.is_empty() {
for i in input.iter() {
let view = TreeView::from_value(i);
let _ = view.render_view();
}
}
}
}