From d3a19c5ac7fe1c65c8fc5e2f734279b78888e35c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20N=2E=20Robalino?= Date: Thu, 15 Dec 2022 15:00:48 -0500 Subject: [PATCH] (register-plugins.nu): Filter out files ending with .d on systems other than windows. (#7492) --- register-plugins.nu | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/register-plugins.nu b/register-plugins.nu index bf5c1a99f7..6b5a2cc7d8 100644 --- a/register-plugins.nu +++ b/register-plugins.nu @@ -9,11 +9,19 @@ def register_plugin [plugin] { nu -c $'register ($plugin)' } +def windows? [] { + $nu.os-info.name == windows +} + +def keep-plugin-executables [] { + if (windows?) { $in } else { where name !~ '\.d' } +} + # get list of all plugin files from their installed directory let plugin_location = ((which nu).path.0 | path dirname) # for each plugin file, print the name and launch another instance of nushell to register it -for plugin in (ls $"($plugin_location)/nu_plugin_*") { +for plugin in (ls $"($plugin_location)/nu_plugin_*" | keep-plugin-executables) { match ($plugin.name | path basename | str replace '\.exe$' '') { nu_plugin_custom_values: { register_plugin $plugin.name } nu_plugin_example: { register_plugin $plugin.name }