From c63943209158663b4b0042cc6b2ce62467fc42e6 Mon Sep 17 00:00:00 2001 From: Andy Gayton Date: Thu, 4 Jul 2024 23:46:43 -0400 Subject: [PATCH] wip --- crates/nu-parser/src/parser.rs | 9 --------- crates/nu-plugin/src/plugin/command.rs | 2 +- crates/nu-plugin/src/plugin/mod.rs | 2 +- crates/nu-protocol/src/plugin/registered.rs | 2 +- crates/nu_plugin_formats/README.md | 4 ++-- crates/nu_plugin_gstat/README.md | 4 ++-- crates/nu_plugin_inc/README.md | 4 ++-- crates/nu_plugin_python/nu_plugin_python_example.py | 4 ++-- 8 files changed, 11 insertions(+), 20 deletions(-) diff --git a/crates/nu-parser/src/parser.rs b/crates/nu-parser/src/parser.rs index 3ff7396e79..b274d77404 100644 --- a/crates/nu-parser/src/parser.rs +++ b/crates/nu-parser/src/parser.rs @@ -5275,15 +5275,6 @@ pub fn parse_expression(working_set: &mut StateWorkingSet, spans: &[Span]) -> Ex } b"where" => parse_where_expr(working_set, &spans[pos..]), #[cfg(feature = "plugin")] - b"register" => { - working_set.error(ParseError::BuiltinCommandInPipeline( - "register".into(), - spans[0], - )); - - parse_call(working_set, &spans[pos..], spans[0]) - } - #[cfg(feature = "plugin")] b"plugin" => { if spans.len() > 1 && working_set.get_span_contents(spans[1]) == b"use" { // only 'plugin use' is banned diff --git a/crates/nu-plugin/src/plugin/command.rs b/crates/nu-plugin/src/plugin/command.rs index 7ccedfd4e5..d33fc445e2 100644 --- a/crates/nu-plugin/src/plugin/command.rs +++ b/crates/nu-plugin/src/plugin/command.rs @@ -340,7 +340,7 @@ where /// Build a [`PluginSignature`] from the signature-related methods on [`PluginCommand`]. /// -/// This is sent to the engine on `register`. +/// This is sent to the engine on `plugin add`. /// /// This is not a public API. #[doc(hidden)] diff --git a/crates/nu-plugin/src/plugin/mod.rs b/crates/nu-plugin/src/plugin/mod.rs index 997381f97b..2bf7f9fc07 100644 --- a/crates/nu-plugin/src/plugin/mod.rs +++ b/crates/nu-plugin/src/plugin/mod.rs @@ -38,7 +38,7 @@ pub(crate) const OUTPUT_BUFFER_SIZE: usize = 16384; /// The API for a Nushell plugin /// /// A plugin defines multiple commands, which are added to the engine when the user calls -/// `register`. +/// `plugin add`. /// /// The plugin must be able to be safely shared between threads, so that multiple invocations can /// be run in parallel. If interior mutability is desired, consider synchronization primitives such diff --git a/crates/nu-protocol/src/plugin/registered.rs b/crates/nu-protocol/src/plugin/registered.rs index abd75b4dc6..56d7f4079a 100644 --- a/crates/nu-protocol/src/plugin/registered.rs +++ b/crates/nu-protocol/src/plugin/registered.rs @@ -26,7 +26,7 @@ pub trait RegisteredPlugin: Send + Sync { fn stop(&self) -> Result<(), ShellError>; /// Stop the plugin and reset any state so that we don't make any assumptions about the plugin - /// next time it launches. This is used on `register`. + /// next time it launches. This is used on `plugin add`. fn reset(&self) -> Result<(), ShellError>; /// Cast the pointer to an [`Any`] so that its concrete type can be retrieved. diff --git a/crates/nu_plugin_formats/README.md b/crates/nu_plugin_formats/README.md index 2b5fc2d829..a7ee046f99 100644 --- a/crates/nu_plugin_formats/README.md +++ b/crates/nu_plugin_formats/README.md @@ -12,7 +12,7 @@ A nushell plugin to convert data to nushell tables. # Usage 1. compile the binary: `cargo build` -2. register plugin(assume it's compiled in ./target/debug/): +2. plugin add plugin(assume it's compiled in ./target/debug/): ``` -register ./target/debug/nu_plugin_formats +plugin add ./target/debug/nu_plugin_formats ``` diff --git a/crates/nu_plugin_gstat/README.md b/crates/nu_plugin_gstat/README.md index 88db33cbf8..7b9ab158ec 100644 --- a/crates/nu_plugin_gstat/README.md +++ b/crates/nu_plugin_gstat/README.md @@ -8,6 +8,6 @@ To install: > cargo install --path . ``` -To register (from inside Nushell): +To add the plugin (from inside Nushell): ``` -> register +> plugin add diff --git a/crates/nu_plugin_inc/README.md b/crates/nu_plugin_inc/README.md index e989aba0b9..d97443a189 100644 --- a/crates/nu_plugin_inc/README.md +++ b/crates/nu_plugin_inc/README.md @@ -8,6 +8,6 @@ To install: cargo install --path . ``` -To register (from inside Nushell): +To add the plugin (from inside Nushell): ``` -register +> plugin add diff --git a/crates/nu_plugin_python/nu_plugin_python_example.py b/crates/nu_plugin_python/nu_plugin_python_example.py index 34e54fea71..993e619366 100755 --- a/crates/nu_plugin_python/nu_plugin_python_example.py +++ b/crates/nu_plugin_python/nu_plugin_python_example.py @@ -7,7 +7,7 @@ # decode and encode information that is read and written to stdin and stdout # # To register the plugin use: -# register +# plugin add # # Be careful with the spans. Miette will crash if a span is outside the # size of the contents vector. We strongly suggest using the span found in the @@ -258,4 +258,4 @@ if __name__ == "__main__": if len(sys.argv) == 2 and sys.argv[1] == "--stdio": plugin() else: - print("Run me from inside nushell!") \ No newline at end of file + print("Run me from inside nushell!")