mirror of
https://github.com/nushell/nushell
synced 2024-12-27 21:43:09 +00:00
Simplify register-plugins.nu (#7636)
This commit is contained in:
parent
ececca7ad2
commit
e56c01d0e2
1 changed files with 7 additions and 33 deletions
|
@ -1,15 +1,3 @@
|
|||
# match command
|
||||
def match [input, matchers: record] {
|
||||
echo $matchers | get $input | do $in
|
||||
}
|
||||
|
||||
# register plugin
|
||||
def register_plugin [plugin] {
|
||||
print -n $"registering ($plugin), "
|
||||
nu -c $'register ($plugin)'
|
||||
print "success!"
|
||||
}
|
||||
|
||||
# are we on windows or not?
|
||||
def windows? [] {
|
||||
$nu.os-info.name == windows
|
||||
|
@ -21,28 +9,14 @@ def keep-plugin-executables [] {
|
|||
}
|
||||
|
||||
# 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_*" | 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 }
|
||||
nu_plugin_from_parquet: { register_plugin $plugin.name }
|
||||
nu_plugin_gstat: { register_plugin $plugin.name }
|
||||
nu_plugin_inc: { register_plugin $plugin.name }
|
||||
nu_plugin_query: { register_plugin $plugin.name }
|
||||
nu_plugin_regex: { register_plugin $plugin.name }
|
||||
nu_plugin_periodic_table: { register_plugin $plugin.name }
|
||||
nu_plugin_pnet: { register_plugin $plugin.name }
|
||||
nu_plugin_python: { register_plugin $plugin.name }
|
||||
nu_plugin_bio: { register_plugin $plugin.name }
|
||||
nu_plugin_dcm: { register_plugin $plugin.name }
|
||||
nu_plugin_dotenv: { register_plugin $plugin.name }
|
||||
nu_plugin_from_bencode: { register_plugin $plugin.name }
|
||||
}
|
||||
ls ((which nu).path.0 | path dirname)
|
||||
| where name =~ nu_plugin
|
||||
| keep-plugin-executables
|
||||
| each {|plugin|
|
||||
print -n $"registering ($plugin.name), "
|
||||
nu -c $"register '($plugin.name)'"
|
||||
print "success!"
|
||||
}
|
||||
|
||||
# print helpful message
|
||||
print "\nplugins registered, please restart nushell"
|
||||
|
||||
|
|
Loading…
Reference in a new issue