nushell/crates/nu_plugin_example/src/lib.rs
Devyn Cairns a29efe28f7
Merge stream_example into example plugin and clean up names (#12234)
# Description

As suggested by @WindSoilder, since plugins can now contain both simple
commands that produce `Value` and commands that produce `PipelineData`
without having to choose one or the other for the whole plugin, this
change merges `stream_example` into `example`.

# User-Facing Changes

All of the example plugins are renamed.

# Tests + Formatting

- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- 🟢 `toolkit test`
- 🟢 `toolkit test stdlib`

# After Submitting

- [ ] Check nushell/nushell.github.io for any docs that match the
command names changed
2024-03-19 12:36:46 -05:00

34 lines
890 B
Rust

use nu_plugin::{Plugin, PluginCommand};
mod commands;
mod example;
pub use commands::*;
pub use example::Example;
impl Plugin for Example {
fn commands(&self) -> Vec<Box<dyn PluginCommand<Plugin = Self>>> {
// This is a list of all of the commands you would like Nu to register when your plugin is
// loaded.
//
// If it doesn't appear on this list, it won't be added.
vec![
Box::new(Main),
// Basic demos
Box::new(One),
Box::new(Two),
Box::new(Three),
// Engine interface demos
Box::new(Config),
Box::new(Env),
Box::new(DisableGc),
// Stream demos
Box::new(CollectExternal),
Box::new(ForEach),
Box::new(Generate),
Box::new(Seq),
Box::new(Sum),
]
}
}