forked from extern/nushell
Ensure stable plugins get installed. (#1373)
This commit is contained in:
committed by
GitHub
parent
20ab125861
commit
29ccb9f5cd
21
crates/nu_plugin_tree/src/nu/mod.rs
Normal file
21
crates/nu_plugin_tree/src/nu/mod.rs
Normal file
@ -0,0 +1,21 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user