mirror of
https://github.com/nushell/nushell.git
synced 2025-05-30 06:39:33 +02:00
* 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
26 lines
663 B
Rust
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()))
|
|
}
|
|
}
|