feat(nushell)!: improve nushell support for nushell v0.96+

This commit is contained in:
Zhaosheng Pan committed 2025-05-21 22:45:12 +08:00
1 parent 23aeabedd9
commit ef8767c5f0
2 files changed
+7 -6

No files matched your search

+3 -5
View File
@@ -122,12 +122,10 @@ z -b foo bar # replace foo with bar in cwd and cd there
Put something like this in your `env.nu`:
lua /path/to/z.lua --init nushell | save -f ~/.cache/zlua.nu
mkdir ($nu.data-dir | path join "vendor/autoload")
lua /path/to/z.lua --init nushell | save -f ($nu.data-dir | path join "vendor/autoload/zlua.nu")
Then put something like this in your `config.nu`:
source ~/.cache/zlua.nu
alias z = _zlua
Note: Only Nushell v0.96+ is supported
- Power Shell:
+4 -1
View File
@@ -2814,7 +2814,7 @@ end
-- nushell
-----------------------------------------------------------------------
local script_zlua_nushell = [[
def _zlua --env --wrapped [...args: string] {
export def _zlua --env --wrapped [...args: string] {
if ($args | length) != 0 and $args.0 == "--add" {
with-env { _ZL_RANDOM: (random int) } { ^$env.ZLUA_LUAEXE $env.ZLUA_SCRIPT --add ...($args | skip 1) }
} else if ($args | length) != 0 and $args.0 == "--complete" {
@@ -2899,6 +2899,9 @@ if completer in $env.config.completions.external {
}
})
}
export alias z = _zlua
]]
-----------------------------------------------------------------------