Jakub Žádník 2873e943b3
Add search terms to Command and Signature (#4980)
* Add search terms to command

* Rename Signature desc to usage

To be named uniformly with extra_usage

* Throw in foldl search term for reduce

* Add missing usage to post

* Add search terms to signature

* Try to add capnp Signature serialization
2022-03-27 22:25:30 +03:00

26 lines
663 B
Rust

#[cfg(test)]
mod tests;
use crate::ToBson;
use nu_errors::ShellError;
use nu_plugin::Plugin;
use nu_protocol::{ReturnValue, Signature, Value};
use nu_source::Tag;
impl Plugin for ToBson {
fn config(&mut self) -> Result<Signature, ShellError> {
Ok(Signature::build("to bson")
.usage("Convert table into .bson binary")
.filter())
}
fn filter(&mut self, input: Value) -> Result<Vec<ReturnValue>, ShellError> {
self.state.push(input);
Ok(vec![])
}
fn end_filter(&mut self) -> Result<Vec<ReturnValue>, ShellError> {
Ok(crate::to_bson::to_bson(self.state.clone(), Tag::unknown()))
}
}