2026-01-14 02:59:52 +00:00
|
|
|
#!/usr/bin/env nu
|
|
|
|
|
|
|
|
|
|
# Installation script for nushell and plugins
|
|
|
|
|
# This script registers all plugins with the nushell binary
|
|
|
|
|
|
|
|
|
|
def main [
|
|
|
|
|
--verify # Verify installation after completion
|
|
|
|
|
] {
|
|
|
|
|
print "🚀 Installing Nushell and plugins..."
|
|
|
|
|
|
|
|
|
|
# Get current directory (should be the distribution directory)
|
|
|
|
|
let dist_dir = $env.PWD
|
|
|
|
|
|
|
|
|
|
# Find nushell binary
|
|
|
|
|
let nu_binary = if ("nu" | path exists) {
|
|
|
|
|
"./nu"
|
|
|
|
|
} else if ("nu.exe" | path exists) {
|
|
|
|
|
"./nu.exe"
|
|
|
|
|
} else {
|
|
|
|
|
print "❌ Nushell binary not found in distribution"
|
|
|
|
|
exit 1
|
2026-01-08 09:55:37 +00:00
|
|
|
}
|
|
|
|
|
|
2026-01-14 02:59:52 +00:00
|
|
|
# Find plugin binaries
|
|
|
|
|
let plugins = ls . | where type == "file" | where name =~ "nu_plugin_" | get name
|
2026-01-08 09:55:37 +00:00
|
|
|
|
2026-01-14 02:59:52 +00:00
|
|
|
print $"📦 Found ($plugins | length) plugins to register"
|
2026-01-08 09:55:37 +00:00
|
|
|
|
2026-01-14 02:59:52 +00:00
|
|
|
# Register each plugin
|
|
|
|
|
for plugin in $plugins {
|
|
|
|
|
print $" Registering ($plugin)..."
|
2026-01-21 10:16:40 +00:00
|
|
|
let result = (do {
|
2026-01-14 02:59:52 +00:00
|
|
|
run-external $nu_binary "-c" $"plugin add ./($plugin)"
|
2026-01-21 10:16:40 +00:00
|
|
|
} | complete)
|
|
|
|
|
|
|
|
|
|
if $result.exit_code != 0 {
|
|
|
|
|
print $" ⚠️ Failed to register ($plugin): ($result.stderr)"
|
2026-01-14 02:59:52 +00:00
|
|
|
}
|
|
|
|
|
}
|
2026-01-08 09:55:37 +00:00
|
|
|
|
2026-01-14 02:59:52 +00:00
|
|
|
if $verify {
|
|
|
|
|
print "🔍 Verifying installation..."
|
2026-01-21 10:16:40 +00:00
|
|
|
let verify_result = (do {
|
|
|
|
|
let plugin_list = (run-external $nu_binary "-c" "plugin list" | complete)
|
2026-01-14 02:59:52 +00:00
|
|
|
if $plugin_list.exit_code == 0 {
|
|
|
|
|
print "✅ Plugin verification successful"
|
|
|
|
|
print $plugin_list.stdout
|
|
|
|
|
} else {
|
|
|
|
|
print "❌ Plugin verification failed"
|
|
|
|
|
print $plugin_list.stderr
|
|
|
|
|
}
|
2026-01-21 10:16:40 +00:00
|
|
|
} | complete)
|
|
|
|
|
|
|
|
|
|
if $verify_result.exit_code != 0 {
|
|
|
|
|
print $"❌ Verification failed: ($verify_result.stderr)"
|
2026-01-14 02:59:52 +00:00
|
|
|
}
|
|
|
|
|
}
|
2026-01-08 09:55:37 +00:00
|
|
|
|
2026-01-14 02:59:52 +00:00
|
|
|
print "✅ Installation complete!"
|
2026-01-08 09:55:37 +00:00
|
|
|
}
|