mirror of
https://github.com/nushell/nushell.git
synced 2025-01-10 16:28:50 +01:00
(register-plugins.nu): Filter out files ending with .d on systems other than windows. (#7492)
This commit is contained in:
parent
080874df10
commit
d3a19c5ac7
@ -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 }
|
||||
|
Loading…
Reference in New Issue
Block a user