From b27cd70fd1875d301c8b577536c6fee46ad02e5c Mon Sep 17 00:00:00 2001 From: Andy Gayton Date: Fri, 5 Jul 2024 08:16:50 -0400 Subject: [PATCH] remove the deprecated `register` command (#13297) # Description This PR removes the `register` command which has been [deprecated](https://www.nushell.sh/blog/2024-04-30-nushell_0_93_0.html#register-toc) in favor of [`plugin add`](https://www.nushell.sh/blog/2024-04-30-nushell_0_93_0.html#redesigned-plugin-management-commands-toc) # User-Facing Changes `register` is no longer available --- crates/nu-cmd-plugin/src/commands/mod.rs | 2 - .../nu-cmd-plugin/src/commands/plugin/stop.rs | 2 +- crates/nu-cmd-plugin/src/commands/register.rs | 80 ------ crates/nu-cmd-plugin/src/default_context.rs | 1 - crates/nu-parser/src/lib.rs | 3 - crates/nu-parser/src/parse_keywords.rs | 239 ------------------ crates/nu-parser/src/parser.rs | 11 - crates/nu-plugin-engine/src/context.rs | 4 +- crates/nu-plugin/src/plugin/command.rs | 2 +- crates/nu-plugin/src/plugin/mod.rs | 2 +- crates/nu-protocol/src/config/mod.rs | 2 +- crates/nu-protocol/src/engine/engine_state.rs | 4 +- crates/nu-protocol/src/plugin/registered.rs | 2 +- crates/nu_plugin_example/README.md | 6 +- crates/nu_plugin_formats/README.md | 4 +- crates/nu_plugin_gstat/README.md | 4 +- crates/nu_plugin_inc/README.md | 4 +- .../nu_plugin_python_example.py | 4 +- crates/nu_plugin_query/README.md | 4 +- docker/Dockerfile | 2 +- scripts/README.md | 1 - scripts/register-plugins.nu | 55 ---- tests/repl/test_parser.rs | 33 --- 23 files changed, 24 insertions(+), 447 deletions(-) delete mode 100644 crates/nu-cmd-plugin/src/commands/register.rs delete mode 100644 scripts/register-plugins.nu diff --git a/crates/nu-cmd-plugin/src/commands/mod.rs b/crates/nu-cmd-plugin/src/commands/mod.rs index 3e927747f1..17ff32faa1 100644 --- a/crates/nu-cmd-plugin/src/commands/mod.rs +++ b/crates/nu-cmd-plugin/src/commands/mod.rs @@ -1,5 +1,3 @@ mod plugin; -mod register; pub use plugin::*; -pub use register::Register; diff --git a/crates/nu-cmd-plugin/src/commands/plugin/stop.rs b/crates/nu-cmd-plugin/src/commands/plugin/stop.rs index d74ee59a3f..f90eac8411 100644 --- a/crates/nu-cmd-plugin/src/commands/plugin/stop.rs +++ b/crates/nu-cmd-plugin/src/commands/plugin/stop.rs @@ -72,7 +72,7 @@ impl Command for PluginStop { error: format!("Failed to stop the `{}` plugin", name.item), msg: "couldn't find a plugin with this name".into(), span: Some(name.span), - help: Some("you may need to `register` the plugin first".into()), + help: Some("you may need to `plugin add` the plugin first".into()), inner: vec![], }) } diff --git a/crates/nu-cmd-plugin/src/commands/register.rs b/crates/nu-cmd-plugin/src/commands/register.rs deleted file mode 100644 index 2c10456db7..0000000000 --- a/crates/nu-cmd-plugin/src/commands/register.rs +++ /dev/null @@ -1,80 +0,0 @@ -use nu_engine::command_prelude::*; -use nu_protocol::engine::CommandType; - -#[derive(Clone)] -pub struct Register; - -impl Command for Register { - fn name(&self) -> &str { - "register" - } - - fn usage(&self) -> &str { - "Register a plugin." - } - - fn signature(&self) -> nu_protocol::Signature { - Signature::build("register") - .input_output_types(vec![(Type::Nothing, Type::Nothing)]) - .required( - "plugin", - SyntaxShape::Filepath, - "Path of executable for plugin.", - ) - .optional( - "signature", - SyntaxShape::Any, - "Block with signature description as json object.", - ) - .named( - "shell", - SyntaxShape::Filepath, - "path of shell used to run plugin (cmd, sh, python, etc)", - Some('s'), - ) - .category(Category::Plugin) - } - - fn extra_usage(&self) -> &str { - r#" -Deprecated in favor of `plugin add` and `plugin use`. - -This command is a parser keyword. For details, check: - https://www.nushell.sh/book/thinking_in_nu.html -"# - .trim() - } - - fn search_terms(&self) -> Vec<&str> { - vec!["add"] - } - - fn command_type(&self) -> CommandType { - CommandType::Keyword - } - - fn run( - &self, - _engine_state: &EngineState, - _stack: &mut Stack, - _call: &Call, - _input: PipelineData, - ) -> Result { - Ok(PipelineData::empty()) - } - - fn examples(&self) -> Vec { - vec![ - Example { - description: "Register `nu_plugin_query` plugin from ~/.cargo/bin/ dir", - example: r#"register ~/.cargo/bin/nu_plugin_query"#, - result: None, - }, - Example { - description: "Register `nu_plugin_query` plugin from `nu -c` (writes/updates $nu.plugin-path)", - example: r#"let plugin = ((which nu).path.0 | path dirname | path join 'nu_plugin_query'); nu -c $'register ($plugin); version'"#, - result: None, - }, - ] - } -} diff --git a/crates/nu-cmd-plugin/src/default_context.rs b/crates/nu-cmd-plugin/src/default_context.rs index 601dd52cfc..1ef6a905dd 100644 --- a/crates/nu-cmd-plugin/src/default_context.rs +++ b/crates/nu-cmd-plugin/src/default_context.rs @@ -18,7 +18,6 @@ pub fn add_plugin_command_context(mut engine_state: EngineState) -> EngineState PluginRm, PluginStop, PluginUse, - Register, ); working_set.render() diff --git a/crates/nu-parser/src/lib.rs b/crates/nu-parser/src/lib.rs index 89cba8d243..3c97012e8a 100644 --- a/crates/nu-parser/src/lib.rs +++ b/crates/nu-parser/src/lib.rs @@ -24,6 +24,3 @@ pub use parser::{ is_math_expression_like, parse, parse_block, parse_expression, parse_external_call, parse_unit_value, trim_quotes, trim_quotes_str, unescape_unquote_string, DURATION_UNIT_GROUPS, }; - -#[cfg(feature = "plugin")] -pub use parse_keywords::parse_register; diff --git a/crates/nu-parser/src/parse_keywords.rs b/crates/nu-parser/src/parse_keywords.rs index 70d217c564..4ac1d20699 100644 --- a/crates/nu-parser/src/parse_keywords.rs +++ b/crates/nu-parser/src/parse_keywords.rs @@ -82,7 +82,6 @@ pub const UNALIASABLE_PARSER_KEYWORDS: &[&[u8]] = &[ b"source-env", b"source", b"where", - b"register", b"plugin use", ]; @@ -3627,244 +3626,6 @@ pub fn parse_where(working_set: &mut StateWorkingSet, lite_command: &LiteCommand } } -/// `register` is deprecated and will be removed in 0.94. Use `plugin add` and `plugin use` instead. -#[cfg(feature = "plugin")] -pub fn parse_register(working_set: &mut StateWorkingSet, lite_command: &LiteCommand) -> Pipeline { - use nu_plugin_engine::PluginDeclaration; - use nu_protocol::{ - engine::Stack, ErrSpan, ParseWarning, PluginIdentity, PluginRegistryItem, PluginSignature, - RegisteredPlugin, - }; - - let spans = &lite_command.parts; - - #[allow(deprecated)] - let cwd = working_set.get_cwd(); - - // Checking that the function is used with the correct name - // Maybe this is not necessary but it is a sanity check - if working_set.get_span_contents(spans[0]) != b"register" { - working_set.error(ParseError::UnknownState( - "internal error: Wrong call name for 'register' function".into(), - Span::concat(spans), - )); - return garbage_pipeline(working_set, spans); - } - if let Some(redirection) = lite_command.redirection.as_ref() { - working_set.error(redirecting_builtin_error("register", redirection)); - return garbage_pipeline(working_set, spans); - } - - // Parsing the spans and checking that they match the register signature - // Using a parsed call makes more sense than checking for how many spans are in the call - // Also, by creating a call, it can be checked if it matches the declaration signature - let (call, call_span) = match working_set.find_decl(b"register") { - None => { - working_set.error(ParseError::UnknownState( - "internal error: Register declaration not found".into(), - Span::concat(spans), - )); - return garbage_pipeline(working_set, spans); - } - Some(decl_id) => { - let ParsedInternalCall { call, output } = - parse_internal_call(working_set, spans[0], &spans[1..], decl_id); - let decl = working_set.get_decl(decl_id); - - let call_span = Span::concat(spans); - - let starting_error_count = working_set.parse_errors.len(); - check_call(working_set, call_span, &decl.signature(), &call); - - let Ok(is_help) = has_flag_const(working_set, &call, "help") else { - return garbage_pipeline(working_set, spans); - }; - - if starting_error_count != working_set.parse_errors.len() || is_help { - return Pipeline::from_vec(vec![Expression::new( - working_set, - Expr::Call(call), - call_span, - output, - )]); - } - - (call, call_span) - } - }; - - // Now that the call is parsed, add the deprecation warning - working_set - .parse_warnings - .push(ParseWarning::DeprecatedWarning { - old_command: "register".into(), - new_suggestion: "use `plugin add` and `plugin use`".into(), - span: call.head, - url: "https://www.nushell.sh/book/plugins.html".into(), - }); - - // Extracting the required arguments from the call and keeping them together in a tuple - let arguments = call - .positional_nth(0) - .map(|expr| { - let val = - eval_constant(working_set, expr).map_err(|err| err.wrap(working_set, call.head))?; - let filename = val - .coerce_into_string() - .map_err(|err| err.wrap(working_set, call.head))?; - - let Some(path) = find_in_dirs(&filename, working_set, &cwd, Some(PLUGIN_DIRS_VAR)) - else { - return Err(ParseError::RegisteredFileNotFound(filename, expr.span)); - }; - - if path.exists() && path.is_file() { - Ok((path, expr.span)) - } else { - Err(ParseError::RegisteredFileNotFound(filename, expr.span)) - } - }) - .expect("required positional has being checked"); - - // Signature is an optional value from the call and will be used to decide if - // the plugin is called to get the signatures or to use the given signature - let signature = call.positional_nth(1).map(|expr| { - let signature = working_set.get_span_contents(expr.span); - serde_json::from_slice::(signature).map_err(|e| { - ParseError::LabeledError( - "Signature deserialization error".into(), - format!("unable to deserialize signature: {e}"), - spans[0], - ) - }) - }); - - // Shell is another optional value used as base to call shell to plugins - let shell = call.get_flag_expr("shell").map(|expr| { - let shell_expr = working_set.get_span_contents(expr.span); - - String::from_utf8(shell_expr.to_vec()) - .map_err(|_| ParseError::NonUtf8(expr.span)) - .and_then(|name| { - canonicalize_with(&name, cwd) - .map_err(|_| ParseError::RegisteredFileNotFound(name, expr.span)) - }) - .and_then(|path| { - if path.exists() & path.is_file() { - Ok(path) - } else { - Err(ParseError::RegisteredFileNotFound( - format!("{path:?}"), - expr.span, - )) - } - }) - }); - - let shell = match shell { - None => None, - Some(path) => match path { - Ok(path) => Some(path), - Err(err) => { - working_set.error(err); - return Pipeline::from_vec(vec![Expression::new( - working_set, - Expr::Call(call), - call_span, - Type::Any, - )]); - } - }, - }; - - // We need the current environment variables for `python` based plugins - // Or we'll likely have a problem when a plugin is implemented in a virtual Python environment. - let get_envs = || { - let stack = Stack::new().capture(); - nu_engine::env::env_to_strings(working_set.permanent_state, &stack) - }; - - let error = arguments.and_then(|(path, path_span)| { - let path = path.path_buf(); - - // Create the plugin identity. This validates that the plugin name starts with `nu_plugin_` - let identity = PluginIdentity::new(path, shell).err_span(path_span)?; - - let plugin = nu_plugin_engine::add_plugin_to_working_set(working_set, &identity) - .map_err(|err| err.wrap(working_set, call.head))?; - - let signatures = signature.map_or_else( - || { - // It's important that the plugin is restarted if we're going to get signatures - // - // The user would expect that `register` would always run the binary to get new - // signatures, in case it was replaced with an updated binary - plugin.reset().map_err(|err| { - ParseError::LabeledError( - "Failed to restart plugin to get new signatures".into(), - err.to_string(), - spans[0], - ) - })?; - - let metadata_and_signatures = plugin - .clone() - .get(get_envs) - .and_then(|p| { - let meta = p.get_metadata()?; - let sigs = p.get_signature()?; - Ok((meta, sigs)) - }) - .map_err(|err| { - log::warn!("Error getting metadata and signatures: {err:?}"); - ParseError::LabeledError( - "Error getting metadata and signatures".into(), - err.to_string(), - spans[0], - ) - }); - - match metadata_and_signatures { - Ok((meta, sigs)) => { - // Set the metadata on the plugin - plugin.set_metadata(Some(meta.clone())); - // Add the loaded plugin to the delta - working_set.update_plugin_registry(PluginRegistryItem::new( - &identity, - meta, - sigs.clone(), - )); - Ok(sigs) - } - Err(err) => Err(err), - } - }, - |sig| sig.map(|sig| vec![sig]), - )?; - - for signature in signatures { - // create plugin command declaration (need struct impl Command) - // store declaration in working set - let plugin_decl = PluginDeclaration::new(plugin.clone(), signature); - - working_set.add_decl(Box::new(plugin_decl)); - } - - Ok(()) - }); - - if let Err(err) = error { - working_set.error(err); - } - - Pipeline::from_vec(vec![Expression::new( - working_set, - Expr::Call(call), - call_span, - Type::Nothing, - )]) -} - #[cfg(feature = "plugin")] pub fn parse_plugin_use(working_set: &mut StateWorkingSet, call: Box) -> Pipeline { use nu_protocol::{FromValue, PluginRegistryFile}; diff --git a/crates/nu-parser/src/parser.rs b/crates/nu-parser/src/parser.rs index c3d18b55ac..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 @@ -5419,8 +5410,6 @@ pub fn parse_builtin_commands( b"export" => parse_export_in_block(working_set, lite_command), b"hide" => parse_hide(working_set, lite_command), b"where" => parse_where(working_set, lite_command), - #[cfg(feature = "plugin")] - b"register" => parse_register(working_set, lite_command), // Only "plugin use" is a keyword #[cfg(feature = "plugin")] b"plugin" diff --git a/crates/nu-plugin-engine/src/context.rs b/crates/nu-plugin-engine/src/context.rs index d5be6ad4b6..c87e64aa48 100644 --- a/crates/nu-plugin-engine/src/context.rs +++ b/crates/nu-plugin-engine/src/context.rs @@ -95,8 +95,8 @@ impl<'a> PluginExecutionContext for PluginExecutionCommandContext<'a> { fn get_plugin_config(&self) -> Result, ShellError> { // Fetch the configuration for a plugin // - // The `plugin` must match the registered name of a plugin. For - // `register nu_plugin_example` the plugin config lookup uses `"example"` + // The `plugin` must match the registered name of a plugin. For `plugin add + // nu_plugin_example` the plugin config lookup uses `"example"` Ok(self .get_config()? .plugins 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/config/mod.rs b/crates/nu-protocol/src/config/mod.rs index 5aa611937b..e804e3f024 100644 --- a/crates/nu-protocol/src/config/mod.rs +++ b/crates/nu-protocol/src/config/mod.rs @@ -104,7 +104,7 @@ pub struct Config { /// Configuration for plugins. /// /// Users can provide configuration for a plugin through this entry. The entry name must - /// match the registered plugin name so `register nu_plugin_example` will be able to place + /// match the registered plugin name so `plugin add nu_plugin_example` will be able to place /// its configuration under a `nu_plugin_example` column. pub plugins: HashMap, /// Configuration for plugin garbage collection. diff --git a/crates/nu-protocol/src/engine/engine_state.rs b/crates/nu-protocol/src/engine/engine_state.rs index 3960f6d9d0..c436621627 100644 --- a/crates/nu-protocol/src/engine/engine_state.rs +++ b/crates/nu-protocol/src/engine/engine_state.rs @@ -741,8 +741,8 @@ impl EngineState { /// Fetch the configuration for a plugin /// - /// The `plugin` must match the registered name of a plugin. For `register nu_plugin_example` - /// the plugin name to use will be `"example"` + /// The `plugin` must match the registered name of a plugin. For `plugin add + /// nu_plugin_example` the plugin name to use will be `"example"` pub fn get_plugin_config(&self, plugin: &str) -> Option<&Value> { self.config.plugins.get(plugin) } 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_example/README.md b/crates/nu_plugin_example/README.md index d4bc6dbe29..98283e9958 100644 --- a/crates/nu_plugin_example/README.md +++ b/crates/nu_plugin_example/README.md @@ -7,10 +7,12 @@ in order to create a binary that can be registered into nushell declaration list This subcommand demonstrates sending configuration from the nushell `$env.config` to a plugin. -To register from after building `nushell` run: +To make use of the plugin after building `nushell` run: ```nushell -register target/debug/nu_plugin_example +plugin add target/debug/nu_plugin_example +# or then either restart your current nushell session or run: +plugin use target/debug/nu_plugin_example ``` The configuration for the plugin lives in `$env.config.plugins.example`: 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!") diff --git a/crates/nu_plugin_query/README.md b/crates/nu_plugin_query/README.md index a3abd18082..621a004806 100644 --- a/crates/nu_plugin_query/README.md +++ b/crates/nu_plugin_query/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/docker/Dockerfile b/docker/Dockerfile index 209b17d419..64c37f6230 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -24,7 +24,7 @@ RUN echo '/usr/bin/nu' >> /etc/shells \ && chmod +x /usr/bin/nu \ && chown -R nushell:nushell /home/nushell/.config/nushell \ && ls /usr/bin/nu_plugin* \ - | xargs -I{} su -c 'register {}' nushell \ + | xargs -I{} su -c 'plugin add {}' nushell \ && rm -rf /tmp/* USER nushell diff --git a/scripts/README.md b/scripts/README.md index 366ff76375..37388e74b5 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -23,5 +23,4 @@ | `coverage-local.sh` | x | x | x | | `install-all.ps1` | ? | x | ? | | `install-all.sh` | x | x | x | -| `register-plugins.nu` | x | x | x | | `uninstall-all.sh` | x | x | x | diff --git a/scripts/register-plugins.nu b/scripts/register-plugins.nu deleted file mode 100644 index 0447ffb0c1..0000000000 --- a/scripts/register-plugins.nu +++ /dev/null @@ -1,55 +0,0 @@ -use std log warning - -warning "./scripts/register-plugin.nu will be deprecated, please use the `toolkit plugin register` command instead" - -# are we on windows or not? -def windows? [] { - $nu.os-info.name == windows -} - -# filter out files that end in .d -def keep-plugin-executables [] { - if (windows?) { where name ends-with '.exe' } else { where name !~ '\.d' } -} - -# get list of all plugin files from their installed directory -let plugins = (ls ((which nu).path.0 | path dirname) | where name =~ nu_plugin | keep-plugin-executables) -for plugin in $plugins { - print -n $"registering ($plugin.name), " - nu -c $"register '($plugin.name)'" - print "success!" -} - -# print helpful message -print "\nplugins registered, please restart nushell" - -# Plugin Location -# https://github.com/nushell/nushell/tree/main/crates/nu_plugin_custom_values -# https://github.com/nushell/nushell/tree/main/crates/nu_plugin_example -# https://github.com/nushell/nushell/tree/main/crates/nu_plugin_gstat -# https://github.com/nushell/nushell/tree/main/crates/nu_plugin_inc -# https://github.com/nushell/nushell/tree/main/crates/nu_plugin_python -# https://github.com/nushell/nushell/tree/main/crates/nu_plugin_query -# https://github.com/fdncred/nu_plugin_from_parquet -# https://github.com/fdncred/nu_plugin_from_regex -# https://github.com/fdncred/nu_plugin_pnet -# https://github.com/JosephTLyons/nu_plugin_periodic_table -# https://github.com/Euphrasiologist/nu_plugin_bio -# https://github.com/realcundo/nu_plugin_dcm -# https://github.com/enerdgumen/nu_plugin_dotenv -# https://github.com/bluk/nu_plugin_from_bencode - -# Older plugins -# https://github.com/notryanb/nu_plugin_id3 -# https://github.com/notryanb/nu_plugin_weather -# https://github.com/tiffany352/nu-plugins/tree/main/from_nbt -# https://github.com/tiffany352/nu-plugins/tree/main/file_exists -# https://github.com/potan/nu_plugin_wifiscan -# https://github.com/autophagy/nu_plugin_from_dhall -# https://github.com/yanganto/nu_plugin_s3 -# https://github.com/lukasreuter/nu_plugin_unity -# https://github.com/filaretov/nu_plugin_path_temp -# https://github.com/cdecompilador/nu_plugin_bg -# https://github.com/aJuvan/nu_plugin_kubectl -# https://github.com/hedonihilist/nu_plugin_df - diff --git a/tests/repl/test_parser.rs b/tests/repl/test_parser.rs index 0efb1d087a..a7a25e1c67 100644 --- a/tests/repl/test_parser.rs +++ b/tests/repl/test_parser.rs @@ -572,39 +572,6 @@ fn unbalanced_parens2() -> TestResult { fail_test(r#"("("))"#, "unbalanced ( and )") } -#[test] -fn register_with_string_literal() -> TestResult { - fail_test(r#"register 'nu-plugin-math'"#, "File not found") -} - -#[test] -fn register_with_string_constant() -> TestResult { - let input = "\ -const file = 'nu-plugin-math' -register $file -"; - // should not fail with `not a constant` - fail_test(input, "File not found") -} - -#[test] -fn register_with_string_variable() -> TestResult { - let input = "\ -let file = 'nu-plugin-math' -register $file -"; - fail_test(input, "Value is not a parse-time constant") -} - -#[test] -fn register_with_non_string_constant() -> TestResult { - let input = "\ -const file = 6 -register $file -"; - fail_test(input, "expected string, found int") -} - #[test] fn plugin_use_with_string_literal() -> TestResult { fail_test(