use nu_engine::{command_prelude::*, get_full_help}; mod add; mod list; mod rm; mod stop; mod use_; pub use add::PluginAdd; pub use list::PluginList; pub use rm::PluginRm; pub use stop::PluginStop; pub use use_::PluginUse; #[derive(Clone)] pub struct PluginCommand; impl Command for PluginCommand { fn name(&self) -> &str { "plugin" } fn signature(&self) -> Signature { Signature::build("plugin") .input_output_types(vec![(Type::Nothing, Type::Nothing)]) .category(Category::Plugin) } fn usage(&self) -> &str { "Commands for managing plugins." } fn run( &self, engine_state: &EngineState, stack: &mut Stack, call: &Call, _input: PipelineData, ) -> Result { Ok(Value::string( get_full_help( &PluginCommand.signature(), &PluginCommand.examples(), engine_state, stack, self.is_parser_keyword(), ), call.head, ) .into_pipeline_data()) } fn examples(&self) -> Vec { vec![ Example { example: "plugin add nu_plugin_inc", description: "Run the `nu_plugin_inc` plugin from the current directory and install its signatures.", result: None, }, Example { example: "plugin use inc", description: " Load (or reload) the `inc` plugin from the plugin registry file and put its commands in scope. The plugin must already be in the registry file at parse time. " .trim(), result: None, }, Example { example: "plugin list", description: "List installed plugins", result: None, }, Example { example: "plugin stop inc", description: "Stop the plugin named `inc`.", result: None, }, Example { example: "plugin rm inc", description: "Remove the installed signatures for the `inc` plugin.", result: None, }, ] } }