add a plugin registration script (#6395)

This commit is contained in:
Darren Schroeder 2022-08-23 19:38:02 -05:00 committed by GitHub
parent ba6abd77c9
commit fce8581321
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

33
register-plugins.nu Normal file
View File

@ -0,0 +1,33 @@
# match command
def match [input, matchers: record] {
echo $matchers | get $input | do $in
}
# 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_*") {
print $"registering ($plugin.name)"
match ($plugin.name | path basename) {
# MacOS/Linux
nu_plugin_custom_values: { nu -c $'register -e msgpack ($plugin.name)' }
nu_plugin_example: { nu -c $'register -e msgpack ($plugin.name)' }
nu_plugin_from_parquet: { nu -c $'register -e json ($plugin.name)' }
nu_plugin_gstat: { nu -c $'register -e msgpack ($plugin.name)' }
nu_plugin_inc: { nu -c $'register -e json ($plugin.name)' }
nu_plugin_query: { nu -c $'register -e json ($plugin.name)' }
# Windows
nu_plugin_custom_values.exe: { nu -c $'register -e msgpack ($plugin.name)' }
nu_plugin_example.exe: { nu -c $'register -e msgpack ($plugin.name)' }
nu_plugin_from_parquet.exe: { nu -c $'register -e json ($plugin.name)' }
nu_plugin_gstat.exe: { nu -c $'register -e msgpack ($plugin.name)' }
nu_plugin_inc.exe: { nu -c $'register -e json ($plugin.name)' }
nu_plugin_query.exe: { nu -c $'register -e json ($plugin.name)' }
}
}
print "\nplugins registered, please restart nushell"
# print "\nplugin commands registered"
# version | get installed_plugins | split row ', '