Skip to content

Commit ef8767c

Browse files
committed
feat(nushell)!: improve nushell support for nushell v0.96+
1 parent 23aeabe commit ef8767c

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,10 @@ z -b foo bar # replace foo with bar in cwd and cd there
122122

123123
Put something like this in your `env.nu`:
124124

125-
lua /path/to/z.lua --init nushell | save -f ~/.cache/zlua.nu
125+
mkdir ($nu.data-dir | path join "vendor/autoload")
126+
lua /path/to/z.lua --init nushell | save -f ($nu.data-dir | path join "vendor/autoload/zlua.nu")
126127

127-
Then put something like this in your `config.nu`:
128-
129-
source ~/.cache/zlua.nu
130-
alias z = _zlua
128+
Note: Only Nushell v0.96+ is supported
131129

132130
- Power Shell:
133131

z.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2814,7 +2814,7 @@ end
28142814
-- nushell
28152815
-----------------------------------------------------------------------
28162816
local script_zlua_nushell = [[
2817-
def _zlua --env --wrapped [...args: string] {
2817+
export def _zlua --env --wrapped [...args: string] {
28182818
if ($args | length) != 0 and $args.0 == "--add" {
28192819
with-env { _ZL_RANDOM: (random int) } { ^$env.ZLUA_LUAEXE $env.ZLUA_SCRIPT --add ...($args | skip 1) }
28202820
} else if ($args | length) != 0 and $args.0 == "--complete" {
@@ -2899,6 +2899,9 @@ if completer in $env.config.completions.external {
28992899
}
29002900
})
29012901
}
2902+
2903+
export alias z = _zlua
2904+
29022905
]]
29032906

29042907
-----------------------------------------------------------------------

0 commit comments

Comments
 (0)